Published
Edited
Aug 1, 2020
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
numberOfWords = Generators.observe(notify => {
const root = document.querySelector(".observablehq").parentNode;
let numberOfWords;
function observed() {
const c = root.childNodes.length;
let n = 0;
for (const childNode of root.childNodes) {
if (childNode.outerText) {
n += computeWordsFromText(childNode.outerText);
}
}
if (n !== numberOfWords) {
notify((numberOfWords = n));
}
}
const observer = new MutationObserver(observed);
observer.observe(root, { childList: true, subtree: true });
observed();
return () => observer.disconnect();
})
Insert cell
Insert cell
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