The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The goal of gargoyle is to provide an event-based mechanism for
{shiny}
.
You can install the dev version of {gargoyle}
with:
::install_github("ColinFay/gargoyle") remotes
{gargoyle}
is a package that provides wrappers around
{shiny}
to turn your app into and event-based application
instead of a full reactive app. The framework is centered around a
listen
& trigger
mechanism.
It works with classical UI, and just needs tweaking the server side of your app.
{shiny}
’s default reactive behavior is very helpful when
it comes to building small applications. Because, you know, the good
thing about reactivity is that when something moves somewhere, it’s
updated everywhere. But the bad thing about reactivity is that when
something moves somewhere, it’s updated everywhere. So it does work
pretty well on small apps, but can get very complicated on bigger apps,
and can quickly get out of hands.
That’s where {gargoyle}
comes into play: it provides an
event based paradigm for building your apps, so that things happen under
a control flow.
If you’re just building small {shiny}
apps, you’re
probably good with {shiny}
default reactive behavior. But
if ever you’ve struggled with reactivity on more bigger apps, you might
find {gargoyle}
useful.
{gargoyle}
will be more verbose and will demand more
work upfront to make things happen. I believe this is for the best if
you’re working on a big project.
{gargoyle}
has:
init
, listen
&
trigger
, which allow to initiate, listen on, and trigger an
event
on
, that runs the expr
when the event
in triggered
gargoyle::trigger()
can print messages to the console
using options("gargoyle.talkative" = TRUE)
.
library(shiny)
library(gargoyle)
options("gargoyle.talkative" = TRUE)
<- function(request){
ui tagList(
h4('Go'),
actionButton("y", "y"),
h4('Output of z$v'),
tableOutput("evt")
)
}
<- function(input, output, session){
server
# Initiating the flags
init( "plop", "pouet", "poum")
# Creating a new env to store values, instead of
# a reactive structure
<- new.env()
z
observeEvent( input$y , {
$v <- mtcars
z# Triggering the flag
trigger("airquality")
})
on("airquality", {
# Triggering the flag
$v <- airquality
ztrigger("iris")
})
on("iris", {
# Triggering the flag
$v <- iris
ztrigger("renderiris")
})
$evt <- renderTable({
output# This part will only render when the renderiris
# flag is triggered
watch("renderiris")
head(z$v)
})
}
shinyApp(ui, server)
You can then get & clear the logs of the times the triggers were called:
get_gargoyle_logs()
clear_gargoyle_logs()
Please note that the gargoyle project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.