rcloud.install.js.module {rcloud.support}R Documentation

Create a JavaScript module

Description

rcloud.install.js.module creates a JavaScript module by evaluating JavaScript code and returning bindings from R to the module.

Usage

rcloud.install.js.module(module.name, module.content, force = FALSE)

Arguments

module.name

string, name of the module. Can be arbitrary but should be unique for each module.

module.content

JavaScript code sonstituting the module code on the JavaScript side - see Details below.

force

logical, if TRUE existing bindings for the same module will be overwritten, if FALSE then no action is performend if the module already exists.

Details

A JavaScript module is created by suppplying valid JavaScript code which evaluates into an object/dictionary. That dictionary is returned in R convering all JavaScript obejcts into R objects. JavaScript functions are returned as R functions invoking the corresponding JavaScript function they reference.

Value

list of objects defined by the JavaScript code of the module

Author(s)

Gordon Woodhull, Simon Urbanek, Carlos Scheidegger

Examples

Run examples

  o <- rcloud.install.js.module("test",
       "({ 'alert': function(x, k) { alert(x); k() } })")
  o$alert("Module installed!")

[Package rcloud.support version 2.3-1 Index]