MenuTroubleshooting / My code did not run as I typed

Docs / Troubleshooting

My code did not run as I typed

A Snippet that reaches outside JSpark waits for you to press Run. Press Run, and it runs.

On this page

Why it waits

JSpark runs your code a moment after you stop typing. It does not do this for a Snippet with Outside Access: code that uses your files, the network, other programs, or JSpark’s own process. Running half-written code of that kind on every pause could write a file or send a request you did not mean to send.

You can see it in two places:

  • In the rail, a shield with an exclamation mark takes the place of the Run as you type button.
  • The footer says Runs on demand.

Hover the shield to see why. It names what the code reaches, for example Uses your files, so auto-run is paused.

The shield says why the Snippet waits; Run runs it.

These count as reaching outside:

  • Node’s file, network and process modules, such as fs, http, child_process and vm.
  • fetch, WebSocket and EventSource, in Node and in a web page.
  • process.env, process.exit() and process.kill().
  • eval, new Function, and an import() or require() whose name is built while the code runs.
  • In a Node Snippet, most npm packages. A few that only compute, such as lodash, date-fns and zod, do not count.

This check is not a sandbox. Once you press Run, a Node Snippet runs as real Node, with your access to your files, network and programs. See Outside Access.

Run it

  1. Finish the code.
  2. Press Run in the rail, or press ⌘↵ or Ctrl+Enter.

The Snippet runs once. It waits for Run again after each change, as long as it has Outside Access. Remove the code that reaches outside, and it runs as you type again.

When Run as you type is off

If there is no shield and the footer says ⌘↵ to run, Run as you type is off for every Snippet. Turn it on with the bolt button in the rail, or in Settings → Running → Run as you type.

The pictures show JSpark on a Mac. On Windows, the window looks a little different and uses Ctrl for ⌘, but everything works the same way.

Esc

Type to search every docs page.