Public
Edited
Jun 29, 2023
Insert cell
Insert cell
source = fetch('https://api.observablehq.com/d/c77fa5b37e91c297.js?v=3').then(d => d.text())
Insert cell
function test(a, b) {
return a + b;
}
Insert cell
module = new Function(source.replace('\nexport default function define(runtime, observer) {\n', '\nreturn function define(runtime, observer) {\n'))
Insert cell
x = {
const res = [];
module()(({
module: () => ({
variable: (name1) => ({
define: (name, args, fun) => {
if (!fun) {
if (Array.isArray(name)) {
res.push([null, name, args.toString()]);
} else {
res.push([name, [], args.toString()]);
}
} else {
res.push([name, args, fun.toString()]);
}
}
})
})
}), arg => arg);
return res;
}
Insert cell
viewof argA = Inputs.range([0, 1], {label: 'A', value: 1})
Insert cell
viewof argB = Inputs.range([0, 1], {label: 'B', value: 0.5})
Insert cell
sum = argA + argB
Insert cell
diff = argA - argB
Insert cell
// import {define} from "https://api.observablehq.com/d/c77fa5b37e91c297@34.js?v=3"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more