Help us shape the future of Go! Take the 2026 Go Developer Survey

playground

command
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL