odin_js_bundle: Create a bundle of an odin model

View source: R/js_bundle.R

odin_js_bundleR Documentation

Create a bundle of an odin model

Description

Create a JavaScript bundle of an odin model

Usage

odin_js_bundle(code, include_support = TRUE)

Arguments

code

An expression, string or path to a file containing odin code (as for odin_parse_). If NULL, compile no model and return only the support code.

include_support

Logical, indicating if the support code should be included. Without this you need to manually copy over odin.js or dust.js depending on what model type you have.

Value

A list, with contents subject to change.

Warning

The interface and generated code here are subject to change. As it stands, it does what is needed for our work in odin.api and does not actually produce a useful bundle!

Examples

js <- odin::odin_js_bundle(quote({
  deriv(x) <- 1
  initial(x) <- 1
}), include_support = FALSE)
head(js$model$code, 20)

richfitz/odin documentation built on Feb. 23, 2024, 1:11 p.m.