Home Reference Source
import JavascriptContext from 'stencila-node/lib/contexts/JavascriptContext.js'
public class | source

JavascriptContext

Extends:

Context → JavascriptContext

Direct Subclass:

NodeContext

An execution context for Javascript

Although this currently resides in the stencila/node repository, it is intended for eventual use within the browser by replacing the JsContext instencila/stencila`

Constructor Summary

Public Constructor
public

Member Summary

Private Members
private

Libraries registered in this context

private

Variables residing in this context

Method Summary

Public Methods
public

async compile(cell: *, internal: boolean): *

Compile a cell

public

async evaluateCall(call: *): *

public

async evaluateGet(get: *): *

public

async execute(cell: *): *

public

async libraries(): *

Get the libraries registered in this context

public

async pack(value: *): *

Pack a value

public

async variables(): *

Get the variables residing in this context

Private Methods
private

_compileFunction(name: *, decl: *, source: *, docs: *): *

Inherited Summary

From class Context
public get

host: *

public get

id: *

public get

location: {"context": *, "host": *, "machine": *}

public get

name: *

private

_host: *

private
private

_name: *

private
public

async compile(cell: *): {"source": *, "expr": *, "global": *, "options": *, "inputs": *, "outputs": *, "messages": *}

public

async evaluate(node: *): *

public

async execute(cell: *): *

public

async libraries(): {}

public

async pack(value: *): *

public

async packPackage(value: *): {"type": *, "data": *}

public

async packPointer(objectPattern: {"type": *, "name": *, "preview": *}): {"type": *, "path": *, "preview": *}

public

async provide(what: *): *

public

async resolve(what: *): *

public

async unpack(node: Object): [type]

Unpack a data node into a native data value

public

async unpackPackage(pkg: *): *

public

async unpackPointer(pointer: *): *

Public Constructors

public constructor() source

Override:

Context#constructor

Private Members

private _libraries: Object source

Libraries registered in this context

private _variables: Object source

Variables residing in this context

Override:

Context#_variables

Public Methods

public async compile(cell: *, internal: boolean): * source

Compile a cell

Override:

Context#compile

Params:

NameTypeAttributeDescription
cell *
internal boolean
  • optional
  • default: false

Return:

*

public async evaluateCall(call: *): * source

Params:

NameTypeAttributeDescription
call *

Return:

*

public async evaluateGet(get: *): * source

Params:

NameTypeAttributeDescription
get *

Return:

*

public async execute(cell: *): * source

Override:

Context#execute

Params:

NameTypeAttributeDescription
cell *

Return:

*

public async libraries(): * source

Get the libraries registered in this context

Override:

Context#libraries

Return:

*

public async pack(value: *): * source

Pack a value

An overide of Context.pack which deals with packing of functions.

Override:

Context#pack

Params:

NameTypeAttributeDescription
value *

Return:

*

public async variables(): * source

Get the variables residing in this context

Return:

*

Private Methods

private _compileFunction(name: *, decl: *, source: *, docs: *): * source

Params:

NameTypeAttributeDescription
name *
decl *
source *
docs *

Return:

*