Skip to content

Commit f1d8e02

Browse files
committed
chore(createContext): update doc blocks
1 parent 20d782e commit f1d8e02

File tree

1 file changed

+10
-11
lines changed
  • packages/0/src/factories/createContext

1 file changed

+10
-11
lines changed

packages/0/src/factories/createContext/index.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import { inject, provide } from 'vue'
55
import type { App, InjectionKey } from 'vue'
66

77
/**
8-
* Simple composable that provides a context for managing application state.
9-
*
10-
* @param key The key to provide or inject the context.
11-
* @template Z The type of the context.
12-
* @returns A function that retrieves the context value for the given key.
8+
* A simple wrapper for tapping into a v0 namespace
9+
* @param key The provided string or InjectionKey
10+
* @template Z The type values for the context.
11+
* @returns A function that retrieves context
1312
*/
1413
export function useContext<Z> (key: InjectionKey<Z> | string) {
1514
return function (): Z {
@@ -19,16 +18,16 @@ export function useContext<Z> (key: InjectionKey<Z> | string) {
1918
throw new Error(`Context "${String(key)}" not found. Ensure it's provided by an ancestor.`)
2019
}
2120

22-
return contextValue as Z
21+
return contextValue
2322
}
2423
}
2524

2625
/**
27-
* Simple composable that wraps Vue's `provide` and `inject` functions.
28-
*
29-
* @param key The key to provide or inject the context.
30-
* @template Z The type of the context.
31-
* @returns A tuple containing the inject function and a provide function.
26+
* A simple wrapper for Vues provide & inject systems
27+
* to create context for managing application state
28+
* @param key The provided string or InjectionKey
29+
* @template Z The type values for the context.
30+
* @returns A tuple containing provide/inject
3231
*/
3332
export function createContext<Z> (key: InjectionKey<Z> | string) {
3433
function provideContext (value: Z, app?: App) {

0 commit comments

Comments
 (0)