Keyboard shortcuts
| Shortcut | Action |
|---|---|
| Ctrl/⌘ + B | Open the command palette from anywhere. |
| Ctrl/⌘ + Enter | Run the current editor. |
| Ctrl/⌘ + Shift + Enter | Stop execution when the editor supports it. |
| F6 / Shift + F6 | Switch focus between the code editor and terminal. |
| Escape | Leave the code editor, or close the command palette. |
Inside the command palette, use the arrow keys to select, Enter to run, and Escape to close. Tab remains inside the palette.
Slugs and autosave
Add a filename after an editor route to create a named local document. Different slugs can be open in separate browser tabs and keep independent source.
/js-editor/my-demo.js
/py-editor/data-check.py
/html-editor/landing-page.htmlToyCode loads editor source in this order:
- Code embedded in a shared URL fragment.
- Source previously autosaved locally for the slug.
- A hosted ToyCode template with that slug.
- An empty editor when the slug cannot be found.
Edits are saved to IndexedDB after about one second. Two browser tabs using the same slug share that saved document, so the last edit saved wins. Use a distinct filename for each document and across editor types.
Runtime storage
Runtime storage is separate from editor-source autosave. Code can use the global asynchronous storage API to keep files and values in this browser:
await storage.set('greeting.txt', 'Hello!')
const greeting = await storage.get('greeting.txt')
const names = await storage.list()
await storage.delete('greeting.txt')Open the Storage UI to inspect, edit, upload, or delete runtime files. This data stays on the current browser and device, is not included in shared code links, and remains until you delete it or clear the site's browser data.