JS: Mark character strings as literal JavaScript code

Description Usage Arguments Author(s) Examples

View source: R/JS.R

Description

This function JS() marks character vectors with a special class, so that it will be treated as literal JavaScript code. It was copied from the htmlwidgets package, and does exactly the same thing.

Usage

1

Arguments

...

character vectors as the JavaScript source code (all arguments will be pasted into one character string)

Author(s)

Yihui Xie

Examples

1
2
3
4
5
ct <- v8()
ct$eval("1+1")
ct$eval(JS("1+1"))
ct$assign("test", JS("2+3"))
ct$get("test")

Example output

Using V8 engine 3.14.5.9
[1] "2"
[1] "2"
[1] 5

V8 documentation built on Nov. 10, 2021, 9:08 a.m.