Skip to content

Instantly share code, notes, and snippets.

View Teebusch's full-sized avatar
↔️

Tobias Busch Teebusch

↔️
View GitHub Profile
@Teebusch
Teebusch / shiny-reactive-R6-object.R
Last active August 15, 2022 05:53 — forked from bborgesr/shiny-reactive-R6-object.R
Uses the reactiveTrigger() construct in an R6 object class in order to make it useful in reactive settings, like a Shiny app (MWE included), extended to multiple reactive values
library(shiny)
reactiveTrigger <- function() {
counter <- reactiveVal(0L)
list(
listen = function() {
counter()
invisible()
},
trigger = function() {