JavaScript

object JavaScript

Guest VM: JavaScript

Convenience entrypoints into JavaScript guest types, including JS embedded and literal scripts. After obtaining an ExecutableScript instance, guest code can be executed by calling any of the "execute" methods present on a JavaScript Runtime instance. These may be obtained from the relevant VM facade factory.

Literal scripts

Literal code can be wrapped in an ExecutableScript via the literal family of methods, which accept string types, InputStream, and Reader. Literal code will be given a special file-name for debugging purposes.

Embedded scripts

Scripts embedded within the host application can be referenced via the embedded series of methods. "Embedded" scripts are retrieved from the host app classpath via Elide's built-in asset mechanisms. These should usually be used in tandem with Elide's Gradle plugin, or related build infrastructure, which packs embedded scripts into a consistent place in the classpath.

File scripts

An external file can be loaded via the file series of methods. Note that these methods always pull from Host I/O, as they are executed outside the guest VM. Once executing, a script can only "see" or access I/O according to the applied guest I/O policy.

Types

Link copied to clipboard
object Inputs

Utilities for creating JavaScript execution inputs.

Functions

Link copied to clipboard

Load JavaScript code from the file at the provided path in the host app classpath, and wrap the result in an ExecutableScript which can be prepared for execution.

Link copied to clipboard

Wrap the provided JavaScript code in an ExecutableScript which can be prepared for execution.