observablehq / runtime

The reactive dataflow runtime that powers Observable Framework and Observable notebooks
https://observablehq.com/@observablehq/how-observable-runs
ISC License
1.01k stars 71 forks source link

Variable-scoped input shadowing #349

Closed duaneatat closed 1 year ago

duaneatat commented 1 year ago

Adds

This will enable variable-scoped input shadowing, e.g.:

main.variable(true).define("val", [], 1000);
const a = main.variable(true).define("a", ["val"], (val) => val);
const b = main.variable(true).define("b", ["val"], (val) => val);
a.shadow("val", 100);
b.shadow("val", 200);
const mainVal = await main.value("val"); // 1000
const aVal = await main.value("a"); // 100
const bVal = await main.value("b"); // 200
duaneatat commented 1 year ago

README changes coming soon 🙏

duaneatat commented 1 year ago

This is ready to go now, we've vetted the changes and they work as expected @mbostock 🙏