Skip to content

Instantly share code, notes, and snippets.

@GordonSmith
Last active July 5, 2020 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GordonSmith/dd577f60842a7b15210b22ff99a91c1e to your computer and use it in GitHub Desktop.
Save GordonSmith/dd577f60842a7b15210b22ff99a91c1e to your computer and use it in GitHub Desktop.
Observable JS Demo
license: gpl-3.0
height: 800
scrolling: yes
border: yes
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://cdn.jsdelivr.net/npm/@hpcc-js/observable-md/dist/index.full.js" type="text/javascript" charset="utf-8"></script>
<script>
var omdMod = window["@hpcc-js/observable-md"]
</script>
</head>
<body onresize="doResize()">
<div id="placeholder">
</div>
<script>
var app = new omdMod.Observable()
.target("placeholder")
.showValues(true)
.mode("ojs")
;
fetch('./test.ojs')
.then(response => response.text())
.then((data) => {
app
.text(data)
.lazyRender()
;
});
;
doResize();
function doResize() {
if (app) {
app
.resize()
.lazyRender()
;
}
}
</script>
</body>
</html>
md`# OJS Generator Test`;
function* range(n) {
for (let i = 0; i < n; ++i) {
yield i;
}
}
{
for (const i of range(Infinity)) {
yield Promises.tick(1000, i + 1);
}
}
md`# Import Test`;
import {viewof selection as cars} from "@d3/brushable-scatterplot";
viewof cars;
md`### Selection:
~~~json
${JSON.stringify(cars, undefined, 2)}
~~~
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment