Skip to content

Commit ecb83ba

Browse files
committed
chore(useRegistrar): update comments
1 parent f10ba28 commit ecb83ba

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

packages/0/src/composables/useRegistrar/index.bench.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
/**
2-
* Benchmark tests for useRegistrar composable
3-
*/
1+
// Composables
2+
import { useRegistrar } from './index'
43

4+
// Utitilities
55
import { describe, it, expect } from 'vitest'
66
import { run, compare } from '#v0/utilities/benchmark'
7-
import { useRegistrar } from './index'
87

98
describe('useRegistrar benchmarks', () => {
109
it('should benchmark registration operations', async () => {

packages/0/src/composables/useRegistrar/index.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import { describe, it, expect } from 'vitest'
1+
// Composables
22
import { useRegistrar } from './index'
33

4+
// Utilities
5+
import { describe, it, expect } from 'vitest'
6+
47
describe('useRegistrar', () => {
58
it('should register and unregister items', () => {
69
const context = useRegistrar('test')[2]

packages/0/src/composables/useRegistrar/index.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Factories
2-
import { createTrinity } from '#v0/factories/createTrinity'
3-
4-
// Composables
52
import { createContext } from '#v0/factories/createContext'
3+
import { createTrinity } from '#v0/factories/createTrinity'
64

75
// Utilities
86
import { reactive } from 'vue'
@@ -19,22 +17,21 @@ export interface RegistrarTicket {
1917

2018
export interface RegistrarContext {
2119
tickets: Reactive<Map<ID, Reactive<any>>>
20+
/** lookup ticket by index number */
2221
lookup: (index: number) => ID | undefined
22+
/** find ticket by id */
2323
find: (id: ID) => Reactive<any> | undefined
2424
register: (ticket?: Partial<RegistrarTicket>, id?: ID) => Reactive<any>
2525
unregister: (id: ID) => void
2626
reindex: () => void
2727
}
2828

2929
/**
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.
3835
*/
3936
export function useRegistrar<
4037
Z extends RegistrarContext,

0 commit comments

Comments
 (0)