source("../object-inheritance.r", chdir = TRUE)
Observable <- Object$clone()$do({
.name <- "Observable"
listeners <- list()
add_listener <- function(f, name = digest::digest(f)) {
self$listeners[[name]] <- f
}
signal <- function(...) {
for(l in self$listeners) l(...)
}
init <- function() {
self$listeners <- list()
}
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.