1
1
// Factories
2
- import { createTrinity } from '#v0/factories/createTrinity'
3
-
4
- // Composables
5
2
import { createContext } from '#v0/factories/createContext'
3
+ import { createTrinity } from '#v0/factories/createTrinity'
6
4
7
5
// Utilities
8
6
import { reactive } from 'vue'
@@ -19,22 +17,21 @@ export interface RegistrarTicket {
19
17
20
18
export interface RegistrarContext {
21
19
tickets : Reactive < Map < ID , Reactive < any > > >
20
+ /** lookup ticket by index number */
22
21
lookup : ( index : number ) => ID | undefined
22
+ /** find ticket by id */
23
23
find : ( id : ID ) => Reactive < any > | undefined
24
24
register : ( ticket ?: Partial < RegistrarTicket > , id ?: ID ) => Reactive < any >
25
25
unregister : ( id : ID ) => void
26
26
reindex : ( ) => void
27
27
}
28
28
29
29
/**
30
- * Simple composable that provides a registrar for managing tickets.
31
- * It allows for registering, unregistering, and reindexing tickets,
32
- * enabling dynamic management of application state.
33
- *
34
- * @param namespace The namespace for the registrar context.
35
- * @template Z The type of the tickets managed by the registrar.
36
- * @template E The type of the registrar context.
37
- * @returns A tuple containing the inject function, provide function, and the registrar context.
30
+ * A composable for managing a collection of info.
31
+ * @param namespace The key to scope the context
32
+ * @template Z The registry context interface.
33
+ * @template E The structure of the tickets.
34
+ * @returns A trinity of registry methods.
38
35
*/
39
36
export function useRegistrar <
40
37
Z extends RegistrarContext ,
0 commit comments