How to use the @observablehq/runtime.Runtime function in @observablehq/runtime

To help you get started, we’ve selected a few @observablehq/runtime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github severo / observable-to-standalone / bundle / step_by_step / joyplot / step2 / src / main.js View on Github external
// Import Observable notebook
import notebook from '@mbostock/psr-b1919-21';

// Import Observable library
import {Runtime, Inspector} from '@observablehq/runtime';

// Render selected notebook cells into DOM elements of this page
const runtime = new Runtime();
const main = runtime.module(notebook, name => {
  switch (name) {
    case 'chart':
      // render 'chart' notebook cell into <div id="joyplot"></div>
      return new Inspector(document.querySelector('#joyplot'));
      break;
  }
});
github codeforboston / windfall-elimination / src / library / generate-runtime.tsx View on Github external
export function generateRuntime(notebook) {
	 	const {modules, id} = notebook;
	 	var library = new Library();
	    var map = new Map;
	    var runtime = new Runtime(library);
	    const main = runtime_module(id);
	    

	    function runtime_module(id) {
		    let module = map.get(id);
		    if (!module) map.set(id, module = runtime.module());
		    return module;
	  	}

	 	for (const m of modules) {
	 		const module = runtime_module(m.id);
	 		let i = 0;
	 		for (const v of m.variables) {
	 				if (v.from) {
	 					module.import(v.remote, v.name, runtime_module(v.from)); 				
	 				} else if (module === main) {

@observablehq/runtime

[![Node CI](https://github.com/observablehq/runtime/workflows/Node%20CI/badge.svg)](https://github.com/observablehq/runtime/actions?workflow=Node+CI) [![Greenkeeper badge](https://badges.greenkeeper.io/observablehq/runtime.svg)](https://greenkeeper.io/)

ISC
Latest version published 1 month ago

Package Health Score

84 / 100
Full package analysis

Similar packages