hotwire: Hotwire Plugin

Description Super classes Methods See Also

Description

Hotwire is an alternative approach to building modern web applications without using much JavaScript by sending HTML instead of JSON over the wire.

Documentation

Super classes

webtools::Configurable -> webtools::Plugin -> Hotwire

Methods

Public methods

Inherited methods

Method new()

Create a new Hotwire Plugin

Usage
Hotwire$new()

Method router()

Create a Hotwire enabled page

Usage
Hotwire$router(
  path,
  handler,
  ...,
  turbo = TRUE,
  stimulus = TRUE,
  lang = NULL,
  fragment = FALSE
)
Arguments
path

(str) endpoint

handler

(fun) handler; must have arguments request, response, keys, ... and set the body to html tags

...

(arg) passed to self$router_html()

turbo

(opt) include turbo assets

  • TRUE - include assets with global defaults (default)

  • FALSE - do not include turbo assets

  • list() - a list that overrides the default config

    • root (str) path of the turbo root

    • libs (str) path of the libraries

    • force_reload (flg) whether this page will force a reload

    • progress_bar (flg) whether progress bar is visible

    • pb_height (css) height of progress bar (top)

    • pb_delay (int) milliseconds of delay before progress bar appears

    • pb_color (css) color fo the progress bar

    • cache_control (str) whether to avoid previewing or caching the page

    • turbo_opt_in (flg) if TRUE, then turbo is disabled across the page

    • turbo_socket (flg) add the turbo web socket

    • app_version (str) a string indicating the version, or NA to disable; used to force reload when assets changed

stimulus

(opt) include stimulus controller assets

  • FALSE - don't include stimulus controllers

  • TRUE - include default stimulus controllers

  • character() - vector of paths to stimulus controller JS files; included along with defaults, include the word "default" to include the default assets

lang

(str) language, defaults to en.

fragment

(flg) - is this just a part of a document


Method clone()

The objects of this class are cloneable with this method.

Usage
Hotwire$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other Hotwire: hotwire_demo(), hotwire_modifiers


tjpalanca/hotwire.R documentation built on Dec. 23, 2021, 10:59 a.m.