ite: Generate JavaScript if/then/else constructs

View source: R/ite.R

iteR Documentation

Generate JavaScript if/then/else constructs

Description

This function is very similar to ifelse. If you would like to use if conditions directly, have a look at the js wrapper instead.

Usage

ite(ifjs, thenjs, elsejs = NULL)

Arguments

ifjs

Either a character string to be placed in the brackets of an if() statement, or an object of class XiMpLe.node. rk.JS.arr or rk.JS.opt (whose identifier will be used).

thenjs

Either a character string, the code to be executed in case the if() statement is true, or an object of class XiMpLe.node. rk.JS.arr or rk.JS.opt (whose identifier will be used). The latter is especially useful in combination with rk.JS.options. You can also give another object of class rk.JS.ite.

elsejs

Like thenjs, the code to be executed in case the if() statement is not true.

Value

An object of class rk.JS.ite

See Also

js, rk.paste.JS, rk.JS.vars, rk.JS.array, rk.JS.options, echo, id, qp, and the Introduction to Writing Plugins for RKWard

Examples

# first create an example checkbox XML node
cbox1 <- rk.XML.cbox(label="foo", value="foo1", id.name="CheckboxFoo.ID")
# now some JavaScript generation
ite(cbox1, echo("bar <- \"", cbox1, "\""), echo("bar <- NULL"))

rkward-community/rkwarddev documentation built on May 9, 2022, 3:02 p.m.