pivot-editor/index.html
2021-05-29 11:58:03 -04:00

60 lines
1.4 KiB
HTML
Executable File

<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="N.js"></script>
<script src="Pivot.js"></script>
</head>
<body>
<script>
var count = 0;
let root = N.Create("root");
let recurse = (node, depth) =>
{
// create a set of new nodes off of the input node
let c1 = N.Create(node.Meta+"-1");
let c2 = N.Create(node.Meta+"-2");
N.Connect(node, c1, "parent");
N.Connect(node, c2, "parent");
var iterator;
if(depth < 2)
{
// loop over the new nodes and keep recursing
iterator = (child) =>
{
recurse(child, depth+1);
};
}
else
{
// walk up
iterator = (child) =>
{
/*
issue: why does incrementing walk id cause an infinite loop
*/
N.ID.Walk++;
count++;
if(count > 100)
{
console.log("big problems");
throw new Error("holy crap");
}
};
}
N.Walk(iterator, node, "parent");
}
N.ID.Walk++;
recurse(root, 0);
</script>
</body>
</html>