Last active
July 5, 2020 14:01
-
-
Save GordonSmith/dd577f60842a7b15210b22ff99a91c1e to your computer and use it in GitHub Desktop.
Observable JS Demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 | |
height: 800 | |
scrolling: yes | |
border: yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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