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.
  • A change to process.env, and process.exit() and process.kill(). Reading process.env doesn't count.
  • A Peek expression that reaches outside, such as //? fetch($).
  • 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.

In JSpark+, a Node Snippet set to a folder of your own with Run → Run in Folder… always waits for Run, whatever its code says. The shield says Uses a folder of yours, so auto-run is paused.

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 buttons are at the top right, the menus are in theMenu button at the left end of the tabs, and shortcuts use Ctrl where a Mac uses ⌘. The rest works the same way.

Esc

Type to search every docs page.

JSpark is downloading

When you open JSpark-Setup.exe, Windows may stop it once, because the installer isn’t code-signed yet. If the file came from jspark.app:

A blue Windows box, “Windows protected your PC”: Microsoft Defender SmartScreen prevented an unrecognised app from starting. Under it, the link More info, and the button Don’t run.

1Click More info.

The same box after More info: Application JSpark-Setup-1.4.0.exe, Publisher Unknown publisher, and the buttons Run anyway and Don’t run.

2Then click Run anyway.

You see this only once: updates install inside the app. More in Install JSpark.