javascript

fun PolyglotContext.javascript(source: String, esm: Boolean = false, name: String? = null, internals: Boolean = false, interactive: Boolean = false, cached: Boolean = true, uri: URI? = null, unlockInternals: Boolean = false): PolyglotValue

Execute the given JavaScript source code, returning the result. This is equivalent to calling PolyglotContext.evaluate and selecting JavaScript as source language.

Return

The result of the invocation. If esm is true, an object is returned, with exported values as members.

Parameters

source

The JavaScript source code to be executed.

esm

Whether to treat the source as an ESM module. If false, the code is evaluated as CommonJS source.

name

Name to provide for this script.

internals

Whether to treat this code as "internal" to the runtime; this also exposes primordials.

interactive

Whether this script should run interactively; defaults to false.

cached

Whether to allow source-base caching; defaults to true.

uri

Addressable URI to this source code; defaults to null. Generated on-the-fly if not provided.

unlockInternals

Unlocks internal APIs even if a source script is not part of the runtime internals; this is mostly useful for testing and benchmarking/debugging.


Execute the given JavaScript Source, returning the result. This is equivalent to calling PolyglotContext.evaluate and selecting JavaScript as source language.

Return

The result of the invocation; an object is returned, with exported values as members.

Parameters

source

The interpreted JavaScript source code to be executed.