KiteJsScriptEngine

class KiteJsScriptEngine(val instructionBudget: Int = DEFAULT_INSTRUCTION_BUDGET, deadline: () -> Boolean? = null, clock: () -> Long? = null, sealBuiltins: Boolean = true, maxStackBytes: Long = DEFAULT_STACK_BYTES) : KiteScriptEngine(source)

A KiteScriptEngine that runs on KiteJS.

Document scripts are untrusted, so every call runs under instructionBudget: a script that never returns fails with a KiteScriptException instead of hanging the app. By default the built-ins are read-only, so one script cannot redefine what another relies on. Scripts reach nothing outside the engine except the functions and values the host defines.

Constructors

Link copied to clipboard
constructor(instructionBudget: Int = DEFAULT_INSTRUCTION_BUDGET, deadline: () -> Boolean? = null, clock: () -> Long? = null, sealBuiltins: Boolean = true, maxStackBytes: Long = DEFAULT_STACK_BYTES)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Interpreter steps one call may take before it stops. 0 means no limit.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun defineFunction(name: String, function: (List<Any?>) -> Any?)
Link copied to clipboard
open override fun defineValue(name: String, value: Any?)
Link copied to clipboard
open override fun evaluate(source: String, name: String): String?
Link copied to clipboard
open suspend override fun evaluatePausing(source: String, name: String): String?

On the web, with WebAssembly stack switching, a long script pauses about once a frame (#489).