Description Usage Arguments Details Value Examples
At times it can be useful to have an explicit mechanism to cause a reactive
expression to invalidate. Create a reactive trigger outside of the reactive
expression using rx_trigger
, then have the reactive expression call
the reactive trigger like a function–this will take a reactive dependency on
the trigger. When you want to cause the reactive expression to invalidate,
call rx_fire_trigger(trigger)
.
1 2 3 | rx_trigger()
rx_fire_trigger(rxtrig)
|
rxtrig |
The trigger to fire. |
rx_trigger
is the constructor for the reactive trigger. The reactive
trigger object that it produces should be called like a function from
whatever reactive context wants to be triggered by it.
To fire a reactive trigger, pass it to the rx_fire_trigger
function.
rx_trigger
returns a function-like object that you can call to
take a dependency on the trigger.
1 2 3 4 5 6 7 8 9 10 11 | trig <- rx_trigger()
now <- rx_exec({
trig()
print(Sys.time())
})
rx_exec({
shiny::invalidateLater(1000, NULL)
rx_fire_trigger(trig)
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.