JSContext-method-source {QuickJSR} | R Documentation |
Evaluate JS string or file in the current context
Description
Evaluate a provided JavaScript file or string within the initialised context.
Note that this method should only be used for initialising functions or values
within the context, no values are returned from this function. See the $call()
method for returning values.
Usage
source(file = NULL, code = NULL)
Arguments
file |
A path to the JavaScript file to load |
code |
A single string of JavaScript to evaluate |
Format
An object of class NULL
of length 0.
Value
No return value, called for side effects
Examples
## Not run:
ctx <- JSContext$new()
ctx$source(file = "path/to/file.js")
ctx$source(code = "1 + 2")
## End(Not run)
[Package QuickJSR version 1.3.1 Index]