Published unlisted
Edited
Jul 20, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof setTimeoutVersion = {
reset;
let output = htl.html`<i>cell<i>`; // todo: some view of the data
output.value = [];

let interval = setInterval(() => {
if (!viewof stop.value) {
output.value.push(new Date());
output.dispatchEvent(new Event("input"));
}
}, 1000);
invalidation.then(() => clearInterval(interval));

return output;
}
Insert cell
Plot.plot({
x: { label: "array index" },
y: { label: "tick timestamp" },
marks: [
Plot.dot(setTimeoutVersion, { x: (d, i) => i, y: (d) => d, y: (d) => d })
]
})
Insert cell
Insert cell
generatorVersion = {
reset;
let value = [];
yield value;
while (true) {
await Promises.delay(1000);
if (!viewof stop.value) value.push(new Date());
yield value;
}
}
Insert cell
Plot.plot({
x: { label: "array index" },
y: { label: "tick timestamp" },
marks: [Plot.dot(generatorVersion, { x: (d, i) => i, y: (d) => d })]
})
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