Home Reference Source
import Engine from 'esper.js/src/Engine.js'
public class | source

Engine

Container class for all of esper.

Constructor Summary

Public Constructor
public

constructor(options: *, realm: boolean)

Member Summary

Public Members
public
public

evloop: {"next": *}

public get
public set
public get

Refrence to the global scope.

public get
public

options: {}

public

realm: *

public

runtime: *

public

threads: *[]

Method Summary

Public Methods
public

addGlobal(name: *, what: *, opts: *)

public

addGlobalBridge(name: *, what: *, opts: *)

public

addGlobalFx(name: *, what: *, opts: *)

public

addGlobalValue(name: *, what: *, opts: *)

public

Evalute code and return a promise for the result.

public

evalAST(ast: Node, codeRef: string): Value

Evalute ast and return a promise for the result.

public

evalASTSync(ast: *, opts: *): *

public

evalDetatched(code: *): *

public

Evalute code and return a the result.

public

fetchFunction(name: *, shouldYield: *): *

public

fetchFunctionSync(name: *, shouldYield: *): *

public

* filterGenerator(gen: *, shouldYield: *, evaluator: *): *

public

Returns a new engine that executes in the same Realm.

public

functionFromAST(ast: *, shouldYield: *, source: *): *

public

functionFromASTSync(ast: *, shouldYield: *, source: *): *

public

functionFromSource(source: *, shouldYield: *): *

public

functionFromSourceSync(source: *, shouldYield: *): *

public

load(code: *)

public

loadAST(ast: *, opts: *)

public
public
public

makeFunctionFromClosure(val: *, shouldYield: *, evalu: *): *

public

preprocessAST(ast: *, opts: *): *

public

run(): *

public

runSync(): *

public

step(): *

Public Constructors

public constructor(options: *, realm: boolean) source

Params:

NameTypeAttributeDescription
options *
realm boolean
  • optional
  • default: false

Public Members

public evaluator: * source

public evloop: {"next": *} source

public get generator: * source

public set generator: * source

public get globalScope: Scope: * source

Refrence to the global scope.

Return:

Scope

public get language: * source

public options: {} source

public realm: * source

public runtime: * source

public threads: *[] source

Public Methods

public addGlobal(name: *, what: *, opts: *) source

Params:

NameTypeAttributeDescription
name *
what *
opts *

public addGlobalBridge(name: *, what: *, opts: *) source

Params:

NameTypeAttributeDescription
name *
what *
opts *

public addGlobalFx(name: *, what: *, opts: *) source

Params:

NameTypeAttributeDescription
name *
what *
opts *

public addGlobalValue(name: *, what: *, opts: *) source

Params:

NameTypeAttributeDescription
name *
what *
opts *

public eval(code: string): Promise<Value> source

Evalute code and return a promise for the result.

Params:

NameTypeAttributeDescription
code string

String of code to evaluate

Return:

Promise<Value>

The result of execution, as a promise.

public evalAST(ast: Node, codeRef: string): Value source

Evalute ast and return a promise for the result.

Params:

NameTypeAttributeDescription
ast Node

ESTree AST representing the code to run.

codeRef string

The code that was used to generate the AST.

Return:

Value

The result of execution, as a promise.

public evalASTSync(ast: *, opts: *): * source

Params:

NameTypeAttributeDescription
ast *
opts *

Return:

*

public evalDetatched(code: *): * source

Params:

NameTypeAttributeDescription
code *

Return:

*

public evalSync(code: string): Value source

Evalute code and return a the result.

Params:

NameTypeAttributeDescription
code string

String of code to evaluate

Return:

Value

The result of execution

public fetchFunction(name: *, shouldYield: *): * source

Params:

NameTypeAttributeDescription
name *
shouldYield *

Return:

*

public fetchFunctionSync(name: *, shouldYield: *): * source

Params:

NameTypeAttributeDescription
name *
shouldYield *

Return:

*

public * filterGenerator(gen: *, shouldYield: *, evaluator: *): * source

Params:

NameTypeAttributeDescription
gen *
shouldYield *
evaluator *

Return:

*

public fork(): Engine source

Returns a new engine that executes in the same Realm. Useful for creating threads / coroutines

Return:

Engine

public functionFromAST(ast: *, shouldYield: *, source: *): * source

Params:

NameTypeAttributeDescription
ast *
shouldYield *
source *

Return:

*

public functionFromASTSync(ast: *, shouldYield: *, source: *): * source

Params:

NameTypeAttributeDescription
ast *
shouldYield *
source *

Return:

*

public functionFromSource(source: *, shouldYield: *): * source

Params:

NameTypeAttributeDescription
source *
shouldYield *

Return:

*

public functionFromSourceSync(source: *, shouldYield: *): * source

Params:

NameTypeAttributeDescription
source *
shouldYield *

Return:

*

public load(code: *) source

Params:

NameTypeAttributeDescription
code *

public loadAST(ast: *, opts: *) source

Params:

NameTypeAttributeDescription
ast *
opts *

public loadLangaugeStartupCode() source

public makeEvaluatorClone(): * source

Return:

*

public makeFunctionFromClosure(val: *, shouldYield: *, evalu: *): * source

Params:

NameTypeAttributeDescription
val *
shouldYield *
evalu *

Return:

*

public preprocessAST(ast: *, opts: *): * source

Params:

NameTypeAttributeDescription
ast *
opts *

Return:

*

public run(): * source

Return:

*

public runSync(): * source

Return:

*

public step(): * source

Return:

*