create_file: Create a shiny custom input binding boilerplate

Description Usage Arguments

Description

Creates a script in inst and the R part in ./R

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
create_input_binding(
  name,
  pkg = ".",
  dir = "srcjs",
  open = TRUE,
  dir_create = TRUE,
  initialize = FALSE,
  dev = FALSE,
  events = list(name = "click", rate_policy = FALSE),
  add_reference = TRUE
)

create_output_binding(
  name,
  pkg = ".",
  dir = "srcjs",
  open = TRUE,
  dir_create = TRUE,
  add_reference = TRUE
)

create_custom_handler(
  name,
  pkg = ".",
  dir = "srcjs",
  open = TRUE,
  dir_create = TRUE,
  add_reference = TRUE
)

create_js(
  name,
  pkg = ".",
  dir = "srcjs",
  open = TRUE,
  dir_create = TRUE,
  with_doc_ready = TRUE,
  template = golem::js_template,
  ...,
  add_reference = TRUE
)

create_css(...)

Arguments

name

The name of the module.

pkg

Path to the root of the package. Default is get_golem_wd().

dir

Path to the dir where the file while be created.

open

Should the created file be opened?

dir_create

Creates the directory if it doesn't exist, default is TRUE.

initialize

For JS file - Whether to add the initialize method. Default to FALSE. Some JavaScript API require to initialize components before using them.

dev

Whether to insert console.log calls in the most important methods of the binding. This is only to help building the input binding. Default is FALSE.

events

List of events to generate event listeners in the subscribe method. For instance, list(name = c("click", "keyup"), rate_policy = c(FALSE, TRUE)). The list contain names and rate policies to apply to each event. If a rate policy is found, the debounce method with a default delay of 250 ms is applied. You may edit manually according to https://shiny.rstudio.com/articles/building-inputs.html

add_reference

Whether to add an import statement in main.js. Defaults to TRUE.

with_doc_ready

For JS file - Should the default file include $( document ).ready()?

template

Function writing in the created file. You may overwrite this with your own template function.

...

Arguments to be passed to the template function.


RinteRface/charpente documentation built on Nov. 25, 2021, 11:11 a.m.