Documentation
¶
Rendered for js/wasm
Overview ¶
Command playground is the playground's WebAssembly core. It runs in a Web Worker (web/worker.js), defines three functions, then calls playgroundReady() and waits:
- playgroundRun(markdown, last) runs a notebook, its code cells up to the code cell last (every one when last is negative), and returns what each did, as JSON ([]engine.Result); it calls playgroundStarted(i) as code cell i starts, for the page's time limit;
- playgroundCells(markdown) returns the notebook's cells, as JSON ([]engine.Cell), for a notebook the visitor opens;
- playgroundEdit(markdown, ops) applies edits ([]engine.Op, as JSON) through the format package and returns the notebook written back, as JSON (engine.Edited), or {"error": "..."}.
The page calls them with the whole notebook: one string in, one string out, never a call per widget.
Click to show internal directories.
Click to hide internal directories.