# NOT RUN {
# create a task callback manager
cbman <- svTaskCallbackManager()
# Add a function to activate after each code evaluation in R
cbman$add(function(expr, value, ok, visible) {
cat("Hi from the callback manager!\n")
return(TRUE)
}, name = "exampleHandler")
# Just issue a command and see the callback function activated
1 + 1
# List defined callbacks
cbman$callbacks()
# Remove the callback we just defined
cbman$remove("exampleHandler")
1 + 1
# Remove the task callback manager (base R function)
removeTaskCallback("SV-taskCallbackManager")
# }
Run the code above in your browser using DataLab