View source: R/PropertySet-class.R
properties | R Documentation |
Convenience function for defining a set of reference class fields that signals when set.
properties(fields=list(), prototype=list())
fields |
list of names of the field and associated fields class |
prototype |
A list of values declaring a default value for a field. |
When constructing signaling fields in this way, each field has the ability to register its own signal and at the same time, there is one top level signal which could be emitted no matter which field changes. Please see the example to learn to register global signal and individual signal.
A list that is easily concatenated into the field list
Michael Lawrence, Tengfei Yin
## we could pass prototype as in S4 GPars.gen <- setRefClass("GraphicProperties", fields = properties(fields = list(size = "numeric", color = "character"), prototype = list(size =1, color = "red"))) obj <- GPars.gen$new() ## since it's not PropertySet, no global signal ## let's register individual signal obj$sizeChanged$connect(function(){ print("size changed") }) ## emit signal obj$size <- 3 ## no signal obj$color <- "black"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.