When defining functions separately from the call to topologica (which will be most of the time), it would be nice to specify the inputs at the same location in the code as the function is defined.
// Generates a color string from red, green, and blue values.
const color = ({r, g, b}) => `rgb(${r},${g},${b})`;
// Sets the background color.
const background = ({color}) => {
d3.select('body').style('background-color', color);
}
// Set up the data flow graph.
const dataflow = topologica({
color: [color, 'r, g, b'],
background: [background, 'color']
});
After:
// Generates a color string from red, green, and blue values.
const color = ({r, g, b}) => `rgb(${r},${g},${b})`;
color.inputs = 'r, g, b';
// Sets the background color.
const background = ({color}) => {
d3.select('body').style('background-color', color);
}
background.inputs = 'color'
// Set up the data flow graph.
const dataflow = topologica({ color, background });
When defining functions separately from the call to
topologica
(which will be most of the time), it would be nice to specify the inputs at the same location in the code as the function is defined.Example code from Color Picker Example.
Before:
After: