tinyjs
- Lightweight Embedded JavaScript Engine (a wrapper for TinyJS)
An R interface to the 'TinyJS' — https://github.com/gfwilliams/tiny-js — JavaScript engine; a more lightweight alternative to 'V8' with no external dependencies.
The following functions are implemented:
source_js
: source a javascript fileeval_js
: evaluate javascript stringsjs_get
: get javascript objectsThe following data sets are included:
system.file("js/test001.js", package="tinyjs")
system.file("js/test002.js", package="tinyjs")
system.file("js/test003.js", package="tinyjs")
system.file("js/test004.js", package="tinyjs")
system.file("js/test005.js", package="tinyjs")
system.file("js/test006.js", package="tinyjs")
system.file("js/test007.js", package="tinyjs")
build_win()
devtools::install_github("hrbrmstr/tinyjs")
library(tinyjs)
# current verison
packageVersion("tinyjs")
#> [1] '0.2.0.9000'
eval_js("var a=10;")
js_get("a")
#> [1] 10
eval_js("var b={this:'that', or:4, the:['ot', 'he', 'r']};")
js_get("b")
#> $this
#> [1] "that"
#>
#> $or
#> [1] 4
#>
#> $the
#> [1] "ot" "he" "r"
for(js_fil in sprintf("js/test00%d.js", 1:7)) {
source_js(system.file(js_fil, package="tinyjs"))
print(js_get("result"))
}
#> [1] 1
#> [1] 42
#> [1] 45
#> [1] 1
#> [1] 45
#> [1] 9
#> [1] 9
library(tinyjs)
library(testthat)
date()
#> [1] "Tue Apr 5 17:57:07 2016"
test_dir("tests/")
#> testthat results ========================================================================================================
#> OK: 1 SKIPPED: 0 FAILED: 0
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.