Query the Names of the Current Internal Top-Level Task... (original) (raw)

taskCallbackNames {base} R Documentation

Description

This provides a way to get the names (or identifiers) for the currently registered task callbacks that are invoked at the conclusion of each top-level task. These identifiers can be used to remove a callback.

Usage

getTaskCallbackNames()

Value

A character vector giving the name for each of the registered callbacks which are invoked when a top-level task is completed successfully. Each name is the one used when registering the callbacks and returned as the in the call to [addTaskCallback](../../base/help/addTaskCallback.html).

Note

One can use [taskCallbackManager](../../base/help/taskCallbackManager.html)to manage user-level task callbacks, i.e., S-language functions, entirely within the S language and access the names more directly.

See Also

[addTaskCallback](../../base/help/addTaskCallback.html),[removeTaskCallback](../../base/help/removeTaskCallback.html),[taskCallbackManager](../../base/help/taskCallbackManager.html)

https://developer.r-project.org/TaskHandlers.pdf

Examples

 n <- addTaskCallback(function(expr, value, ok, visible) {
                        cat("In handler\n")
                        return(TRUE)
                      }, name = "simpleHandler")

 getTaskCallbackNames()

   # now remove it by name
 removeTaskCallback("simpleHandler")


 h <- taskCallbackManager()
 h$add(function(expr, value, ok, visible) {
                        cat("In handler\n")
                        return(TRUE)
                      }, name = "simpleHandler")
 getTaskCallbackNames()
 removeTaskCallback("R-taskCallbackManager")

[Package _base_ version 4.6.0 Index]