nteract / jupyter-display-area

:no_entry_sign: Prototype Web Component for Jupyter Display Areas
BSD 3-Clause "New" or "Revised" License
6 stars 6 forks source link

jupyter-display-area

Prototype Web Component for Jupyter Display areas

Installation

npm install jupyter-display-area

Including on a page

<script>
  // Include a polyfill if the browser isn't fully supported
  if ('registerElement' in document
    && 'createShadowRoot' in HTMLElement.prototype
    && 'import' in document.createElement('link')
    && 'content' in document.createElement('template')) {
    console.log("Native web components supported!");
  } else {
    document.write('<script src="https:\/\/cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js"><\/script>')
  }
</script>

<link rel="import" href="https://github.com/nteract/jupyter-display-area/blob/master/dist/jupyter-display-area.html">

<jupyter-display-area id="play-display"></jupyter-display-area>

<script>
    area = document.querySelector("#play-display");
    area.handle(iopub_message); // Accepts Jupyter Protocol messages
</script>

Build

npm run build

Browserified build

ES5 build and direct src

The transpiled ES5 javascript ends up in lib/ while the original ES6 sources are in src/. These are intended for use in Electron/Atom, though you may want to just use the browserified/bundled web component. Your choice!

Dev

Run npm run dev to do automated watch, build, serve, and live-reload.

npm run dev