taskCallbackManager(handlers = list(), registered = FALSE, verbose = FALSE)
"f"
which is a callback function, and an optional
element named "data"
which is the 5-th argument to be
supplied to the callback when it is invoked.
Typically this argument is not specified, and one uses add
to
register callbacks after the manager is created.evaluate
function has already been registered
with the internal task callback mechanism.
This is usually FALSE
and
the first time a callback is added
via the add
function, the
evaluate
function is automatically registered.
One can control when the function is registered
by specifying TRUE
for this argument
and calling addTaskCallback
manually.
TRUE
,
causes information to be printed to the console
about certain activities this dispatch manager performs.
This is useful for debugging callbacks and the handler
itself.
register
argument which controls whether
the evaluate
function is registered with the internal
C-level dispatch mechanism if necessary.status
argument.
evaluate
function with the internal C-level dispatch mechanism. This is
done automatically by the add
function, but can be called
manually.addTaskCallback
,
removeTaskCallback
,
getTaskCallbackNames
\
http://developer.r-project.org/TaskHandlers.pdf
# create the manager
h <- taskCallbackManager()
# add a callback
h$add(function(expr, value, ok, visible) {
cat("In handler\n")
return(TRUE)
}, name = "simpleHandler")
# look at the internal callbacks.
getTaskCallbackNames()
# look at the R-level callbacks
names(h$callbacks())
getTaskCallbackNames()
removeTaskCallback("R-taskCallbackManager")
Run the code above in your browser using DataLab