Published
Edited
Apr 3, 2018
1 star
Insert cell
Insert cell
makeSeriesStream = () => new ReadableStream({
start: async controller => {
for (let i = 1; i <= countTo; i++) {
controller.enqueue(i);
await Promises.delay(100);
}
controller.close();
}
})
Insert cell
makeSeriesStream()
Insert cell
Insert cell
Generators.observe(change => {
makeSeriesStream().pipeTo(new WritableStream({
write(chunk) {
change(chunk);
}
}));
})
Insert cell
Insert cell
{
yield "Piping...";
await makeSeriesStream().pipeTo(new WritableStream({
write(chunk) {
console.log(chunk);
}
}));
yield "Done piping.";
}
Insert cell
Insert cell
makeSeriesStream().getReader().read()
Insert cell
Insert cell
Insert cell
Insert cell
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