Description Usage Arguments Examples
Setting up reactive graphs does nothing until something actually causes
reactive events to be processed. This is handled for you when writing Shiny
apps, but it might also be useful to run reactives outside of Shiny, for
testing and experimentation if nothing else. This function runs an event loop
for reactivity and timer actions. From an interactive console, interrupt it
using Escape
or Ctrl+C
(or whatever the usual interrupt gesture
is in your R environment). You can also stop the loop programmatically by
calling rx_stoploop
.
1 2 3 | rx_runloop(..., before_tick = NULL, after_tick = NULL)
rx_stoploop()
|
... |
Currently ignored. (Used to force other arguments to be passed by name, not by position.) |
before_tick |
A no-argument callback function that will be called before work is done for each iteration. |
after_tick |
A no-argument callback function that will be called after work is done for each iteration. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | counter <- rx_value(0)
rx_exec({
print(counter())
if (counter() == 10)
rx_stoploop()
})
rx_exec({
invalidateLater(100)
isolate({
counter(counter() + 1)
})
})
rx_runloop()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.