Skip to content

Instantly share code, notes, and snippets.

@mbostock
Created August 14, 2018 14:16
Show Gist options
  • Select an option

  • Save mbostock/2d60f87a292ddfa61e6389ea638c70b8 to your computer and use it in GitHub Desktop.

Select an option

Save mbostock/2d60f87a292ddfa61e6389ea638c70b8 to your computer and use it in GitHub Desktop.

Revisions

  1. mbostock created this gist Aug 14, 2018.
    30 changes: 30 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    <!DOCTYPE html>
    <div id="test"></div>
    <script type="module">

    import {Runtime, Inspector, Library} from "https://unpkg.com/@observablehq/notebook-runtime?module";
    import notebook from "https://api.observablehq.com/d/f523a66288d9ab04.js?key=e76719d4648ff9ff";

    const test = document.querySelector("#test");

    const main = {
    id: "main",
    modules: [
    {
    id: "main",
    variables: notebook.modules[0].variables.map(v => {
    return v.name === "subject"
    ? Object.assign(v, {value: "Success"})
    : v;
    })
    }
    ]
    };

    Runtime.load(main, cell => {
    if (cell.name === "greeting") {
    return new Inspector(test);
    }
    });

    </script>