Description Super class Active bindings Methods
Plugins provide additional functionality to an App
. These are the main
mechanisms through which additional functionality is added, as opposed to
using inheritance of the App
object itself.
The Plugin interface is as follows:
plugin$name
- should return a string that identifies this plugin
plugin$on_attach
- is a function that is given the app as a first
argument and attaches the main functionality
of the app.
plugin$on_detach
- is a function that is given the app as a first
argument and removes the main functionality of the
application. By default, it removes all handles,
routers, and statics with metadata plugin == name
.
plugin$requires
- should return a list of plugin names that are
required for this plugin to attach.
Any other methods are made available through the plugin instance. They
can operate on the app method itself through self$app
.
webtools::Configurable
-> Plugin
name
name of the plugin
requires
name(s) of plugins that are required by this plugin
app
attached app instance
fire
fire object attached to app instance
new()
Establishes initial configuration for the Plugin.
Plugin$new(name, requires = NULL)
name
(str) name of the plugin
requires
(chr) additional plugin names that are required
on_attach()
on_attach(app, ...)
should attach all the handlers,
routers, and static paths necessary for this plugin. To make them easier
to detach, add plugin == self$name
to the metadata of the handlers.
Plugin$on_attach(app, ...)
app
(App) instance
...
(arg)s passed to the underlying methods
on_detach()
(optional) should detach all the handlers, routers, and static paths for the plugin. By default it does this by just removing all the elements that have the plugin indicated via metadata.
Plugin$on_detach(app, ...)
app
(App) instance
...
(arg)s passed to the underlying methods
clone()
The objects of this class are cloneable with this method.
Plugin$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.