diff --git a/package.json b/package.json index fc1b01b..af4d57a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "alfama", - "version": "1.3.4", + "version": "1.3.5", "author": "Abhishiv Saxena", "license": "MIT", "description": "Fine-grained reactive library with no compiler, no magic, and no virtual DOM", diff --git a/src/core/constants.ts b/src/core/constants.ts index 1a759c8..62b8a62 100644 --- a/src/core/constants.ts +++ b/src/core/constants.ts @@ -1,5 +1,5 @@ -export const WIRE = Symbol("WIRE"); -export const SIGNAL = Symbol("SIGNAL"); -export const STORE = Symbol("STORE"); -export const SUBTOKEN = Symbol("SUBTOKEN"); -export const SIGNAL_GETTER = Symbol("SIGNAL_GETTER"); +export const WIRE = 0 as const; +export const SIGNAL = 1 as const; +export const STORE = 2 as const; +export const SUBTOKEN = 3 as const; +export const SIGNAL_GETTER = 4 as const; diff --git a/src/utils/crawl.ts b/src/utils/crawl.ts index 1660fb1..cb31a3f 100644 --- a/src/utils/crawl.ts +++ b/src/utils/crawl.ts @@ -16,15 +16,15 @@ export const dfsPostOrder = ( kids: (node: T) => T[] ) => { // The stack holds the nodes we need to visit. - const stack: { node: T; visitedChildren: boolean }[] = []; + const stack: { node: T; v: boolean }[] = []; // Keep track of the nodes we've visited. const visited = new Set(); // Push the root node onto the stack to start the traversal. - stack.push({ node: root, visitedChildren: false }); + stack.push({ node: root, v: false }); while (stack.length > 0) { - const { node, visitedChildren } = stack[stack.length - 1]; + const { node, v: visitedChildren } = stack[stack.length - 1]; // If all the node's children have been visited, visit the node and pop it from the stack. if (visitedChildren) { iterate(node); @@ -32,12 +32,12 @@ export const dfsPostOrder = ( } else { visited.add(node); // Mark that we've visited the node's children. - stack[stack.length - 1].visitedChildren = true; + stack[stack.length - 1].v = true; // Otherwise, push all the unvisited children onto the stack. const children = (kids(node) || []).reverse(); children.forEach((child) => { if (!visited.has(child)) { - stack.push({ node: child, visitedChildren: false }); + stack.push({ node: child, v: false }); } }); }