MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / createInstanceIdAllocator

Function createInstanceIdAllocator

packages/core/src/runtime/instance.ts:23–39  ·  view source on GitHub ↗
(startAt: InstanceId = 1)

Source from the content-addressed store, hash-verified

21 * Each call to allocate() returns the next sequential ID.
22 */
23export function createInstanceIdAllocator(startAt: InstanceId = 1): InstanceIdAllocator {
24 if (!Number.isInteger(startAt) || startAt < 0) {
25 throw new Error(
26 `createInstanceIdAllocator: startAt must be an integer >= 0 (got ${String(startAt)})`,
27 );
28 }
29
30 let next = startAt;
31
32 return Object.freeze({
33 allocate: () => {
34 const id = next;
35 next++;
36 return id;
37 },
38 });
39}

Callers 15

renderAndGetLayoutTreeFunction · 0.85
commitTreeFunction · 0.85
renderOpsFunction · 0.85
renderOpsFunction · 0.85
buildSceneFunction · 0.85
renderOpsFunction · 0.85
renderTextareaWithCursorFunction · 0.85
renderStringsFunction · 0.85
renderOpsFunction · 0.85
commitTreeFunction · 0.85
commitTreeFunction · 0.85

Calls

no outgoing calls

Tested by 15

renderAndGetLayoutTreeFunction · 0.68
commitTreeFunction · 0.68
renderOpsFunction · 0.68
renderOpsFunction · 0.68
buildSceneFunction · 0.68
renderOpsFunction · 0.68
renderTextareaWithCursorFunction · 0.68
renderStringsFunction · 0.68
renderOpsFunction · 0.68
commitTreeFunction · 0.68
commitTreeFunction · 0.68
buildSceneFunction · 0.68