Published
Edited
Aug 2, 2022
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
videoStartAt
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
### (EP02) streaming query (realtime updates)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
endpoint("website", async (req, res) => {
res.send(sensor_page.outerHTML);
})
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
<head>
</head>
<body>
<h1>Agropatterns V2</h1>
<h2>Sensor page</h2>
<div id="errorButton"></div>
<div id="chooser"></div>
<div id="dashboard"></div>
<script type="module">
import {Runtime, Inspector} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
import notebook from "https://api.observablehq.com/@tomlarkworthy/productionization.js?v=3";
new Runtime().module(notebook, name => {
if (name === "dashboard") {
return new Inspector(document.querySelector("#dashboard"));
} else if (name === "viewof querySensorName") {
return new Inspector(document.querySelector("#chooser"));
} else if (name === "viewof errorButton") {
return new Inspector(document.querySelector("#errorButton"));
} else if (name === "mySentry") {
return true
}
});
</script>
</body>
Insert cell
Insert cell
Insert cell
Insert cell
mySentry = {
console.log("sentry has been setup");
return sentry({
DSN:
"https://a6079bd15b7c405bb6346e95a44f3ee8@o1335620.ingest.sentry.io/6603442",
namespaces: ["tomlarkworthy", /* IMPORTANT */ "qafalwyj.com"]
});
}
Insert cell
Insert cell
errorCell = {
throw new Error("Known error");
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more