create_file: Create a shiny custom input binding boilerplate

create_input_bindingR Documentation

Create a shiny custom input binding boilerplate

Description

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

Usage

create_input_binding(
  name,
  pkg = ".",
  dir = "srcjs",
  open = TRUE,
  initialize = FALSE,
  dev = FALSE,
  events = list(name = "click", rate_policy = FALSE),
  add_reference = TRUE
)

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

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

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

create_scss(
  name,
  dir = "styles",
  open = TRUE,
  template = golem::sass_template,
  ...,
  add_reference = TRUE
)

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?

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 March 10, 2024, 4:14 p.m.