Skip to content

Commit

Permalink
rf
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishiv committed Oct 16, 2024
1 parent 539006f commit 31df96a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alfama",
"version": "1.3.4",
"version": "1.3.5",
"author": "Abhishiv Saxena<abhishiv@gmail.com>",
"license": "MIT",
"description": "Fine-grained reactive library with no compiler, no magic, and no virtual DOM",
Expand Down
10 changes: 5 additions & 5 deletions src/core/constants.ts
Original file line number Diff line number Diff line change
@@ -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;
10 changes: 5 additions & 5 deletions src/utils/crawl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ export const dfsPostOrder = <T>(
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);
stack.pop();
} 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 });
}
});
}
Expand Down

0 comments on commit 31df96a

Please sign in to comment.