GitHub

Node CI

The Observable standard library.

For examples, see https://observablehq.com/@observablehq/stdlib.

API Reference

  • DOM - create HTML and SVG elements.
  • Files - read local files into memory.
  • FileAttachments - read remote files.
  • Generators - utilities for generators and iterators.
  • Promises - utilities for promises.
  • require - load third-party libraries.
  • html - render HTML.
  • md - render Markdown.
  • svg - render SVG.
  • tex - render LaTeX.
  • now - the current value of Date.now.
  • width - the current page width.
  • invalidation - dispose resources.
  • visibility - wait for visibility.

DOM

# DOM.canvas(width, height) <>

Returns a new canvas element with the specified width and height. For example, to create a 960×500 canvas:

DOM.canvas(960, 500)

This is equivalent to using the html tagged template literal:

"html`

Read the original on github.com ↗