evaluatePausing

open suspend fun evaluatePausing(source: String, fileName: String = "<eval>", slice: Duration = 16.milliseconds): JsValue(source)

Runs source like evaluate, but where canPause is true the script pauses about every slice and lets the event loop run before it goes on. A long script then does not freeze the page on a platform with one thread.

The script pauses only while no host function runs, and only one such run pauses at a time in a process. While a script is paused, every other call into this engine throws a JsEngineError; other engines stay usable. Where the script cannot pause, it runs to the end in one go.