@@ -5,11 +5,10 @@ import { inject, provide } from 'vue'
5
5
import type { App , InjectionKey } from 'vue'
6
6
7
7
/**
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
13
12
*/
14
13
export function useContext < Z > ( key : InjectionKey < Z > | string ) {
15
14
return function ( ) : Z {
@@ -19,16 +18,16 @@ export function useContext<Z> (key: InjectionKey<Z> | string) {
19
18
throw new Error ( `Context "${ String ( key ) } " not found. Ensure it's provided by an ancestor.` )
20
19
}
21
20
22
- return contextValue as Z
21
+ return contextValue
23
22
}
24
23
}
25
24
26
25
/**
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
32
31
*/
33
32
export function createContext < Z > ( key : InjectionKey < Z > | string ) {
34
33
function provideContext ( value : Z , app ?: App ) {
0 commit comments