Closed curran closed 5 years ago
Sometimes, for simple reactive functions, it's desirable to specify the function and its dependencies more concisely. Proposal: use an array with two elements, the function and the dependencies.
For example: Unpacking objects.
Before:
const DOMScaffold = ({svg}) => ({ axisG: one(svg, 'g.axes'), backgroundMarksG: one(svg, 'g.background-marks'), foregroundMarksG: one(svg, 'g.foreground-marks') }); DOMScaffold.dependencies = 'svg'; const axisG = ({DOMScaffold}) => DOMScaffold.axisG; axisG.dependencies = 'DOMScaffold'; const backgroundMarksG = ({DOMScaffold}) => DOMScaffold.backgroundMarksG; backgroundMarksG.dependencies = 'DOMScaffold'; const foregroundMarksG = ({DOMScaffold}) => DOMScaffold.foregroundMarksG; foregroundMarksG.dependencies = 'DOMScaffold'; const dataFlow = Topologica({ DOMScaffold, axisG, backgroundMarksG, foregroundMarksG });
const DOMScaffold = ({svg}) => ({ axisG: one(svg, 'g.axes'), backgroundMarksG: one(svg, 'g.background-marks'), foregroundMarksG: one(svg, 'g.foreground-marks') }); DOMScaffold.dependencies = 'svg'; const dataFlow = Topologica({ DOMScaffold, axisG: [({DOMScaffold}) => DOMScaffold.axisG, 'DOMScaffold'], backgroundMarksG: [({DOMScaffold}) => DOMScaffold.backgroundMarksG, 'DOMScaffold'], foregroundMarksG: [({DOMScaffold}) => DOMScaffold.foregroundMarksG, 'DOMScaffold'] });
This would simplify the examples in the README as well.
Sometimes, for simple reactive functions, it's desirable to specify the function and its dependencies more concisely. Proposal: use an array with two elements, the function and the dependencies.
For example: Unpacking objects.
Before: