mirror of https://github.com/embarklabs/embark.git
Add API docs for `code-runner` module
parent
76304f83e3
commit
420effbafe
|
@ -1,6 +1,6 @@
|
|||
|
||||
**Core**
|
||||
* code-runner
|
||||
* [code-runner](#code-runner)
|
||||
* console
|
||||
* core
|
||||
* engine
|
||||
|
@ -174,6 +174,43 @@ arguments:
|
|||
|
||||
Returns a provider object that allows libraries to connect to the embark's blockchain node
|
||||
|
||||
### code-runner
|
||||
|
||||
module type: core component
|
||||
|
||||
#### API
|
||||
|
||||
##### requests
|
||||
|
||||
name: 'runcode:register'
|
||||
arguments:
|
||||
* varName {string} - name of the variable to be registered in the VM
|
||||
* code {any} - primitive or object value that will be assign to `varName` inside the VM
|
||||
|
||||
Registers a variable and assigns a value to it inside the VM context.
|
||||
|
||||
name: 'runcode:whitelist'
|
||||
arguments:
|
||||
* varName {string} - name of white node module to be whitelisted for imports inside the VM
|
||||
|
||||
Whitelists a node module inside the VM context for imports. Generally, the VM context is
|
||||
sandboxed, making it impossible to require/import any arbitrary module. This API enables
|
||||
whitelisting of such modules.
|
||||
|
||||
name : 'runcode:getContext'
|
||||
|
||||
Returns the current VM context with its sandbox object and options.
|
||||
|
||||
name: 'runcode:eval'
|
||||
arguments:
|
||||
* code {string} - code to be eval'd inside the sandboxed VM
|
||||
* cb {function} - callback to be called when the evaluation is done
|
||||
* tolerateError {boolean}, default: false - If set to true, errors inside the VM are logged (instead of calling back with an error object)
|
||||
* logCode {boolean}, default: true - log the code if it caused an error
|
||||
* logError {boolean}, default: true - Also logs the error if there is one emitted by the VM
|
||||
|
||||
Runs given code inside a sandboxed VM.
|
||||
|
||||
### communication
|
||||
|
||||
module type: stack component
|
||||
|
|
Loading…
Reference in New Issue