JsScript

abstract class JsScript(source)

A parsed script, ready to run more than once.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun bytecode(): ByteArray?

The compiled form, which KiteJs.loadBytecode reads back in another engine of the same kind without parsing the source again. Null on an engine that has no bytecode, such as Rhino. Bytecode fits only the build of the engine that wrote it, so keep it for this process, or key a saved copy on KiteJs.version.

Link copied to clipboard
abstract fun run(): JsValue

Runs it in the engine's global scope. The answer is its last expression's value.

Link copied to clipboard
open suspend fun runPausing(slice: Duration = 16.milliseconds): JsValue

Runs it as KiteJs.evaluatePausing runs source: pausing about every slice where the engine can.