β¬ οΈ Back to Table of Contents
π createInjectionState¶
π Analysis Summary¶
| Metric | Count |
|---|---|
| π§ Functions | 3 |
| π¦ Imports | 3 |
| π Interfaces | 1 |
| π Type Aliases | 1 |
π Table of Contents¶
π οΈ File Location:¶
π packages/shared/createInjectionState/index.ts
π¦ Imports¶
| Name | Source |
|---|---|
InjectionKey |
vue |
injectLocal |
../injectLocal |
provideLocal |
../provideLocal |
Functions¶
createInjectionState(composable: (...args: Arguments) => Return, options: { defaultValue: Return } & CreateInjectβ¦): CreateInjectionStateReturn<Arguments, Return, Return>¶
Create global state that can be injected into components.
See: https://vueuse.org/createInjectionState
Tags: @__NO_SIDE_EFFECTS__
Raw JSDoc
Code
Internal helpers¶
Declared inside another function in this file.
useProvidingState(args: Arguments): Return¶
Parameters:
argsArguments
Returns: Return
Calls:
composableprovideLocal (from ../provideLocal)
Code
useInjectedState(): any¶
Returns: any
Calls:
injectLocal (from ../injectLocal)
Interfaces¶
CreateInjectionStateOptions<Return>¶
Interface Code
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
injectionKey |
string \| InjectionKey<Return> |
β | not shown |
defaultValue |
Return |
β | not shown |
Type Aliases¶
CreateInjectionStateReturn<Arguments extends Array<any>, ProvideReturn, InjectReturn>¶
type CreateInjectionStateReturn<Arguments extends Array<any>, ProvideReturn, InjectReturn> = Readonly<[
/**
* Call this function in a provider component to create and provide the state.
*
* @param args Arguments passed to the composable
* @returns The state returned by the composable
*/
useProvidingState: (...args: Arguments) => ProvideReturn,
/**
* Call this function in a consumer component to inject the state.
*
* @returns The injected state, or `undefined` if not provided and no default value was set.
*/
useInjectedState: () => InjectReturn,
]>;
Generated by Syntax Scribe