The R Project SVN R

Rev

Rev 70260 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42333 ripley 1
% File src/library/base/man/taskCallbackNames.Rd
68948 ripley 2
% Part of the R package, https://www.R-project.org
70260 ripley 3
% Copyright 1995-2016 R Core Team
42333 ripley 4
% Distributed under GPL 2 or later
5
 
17067 duncan 6
\name{taskCallbackNames}
7
\alias{getTaskCallbackNames}
50821 ripley 8
\title{Query the Names of the Current Internal Top-Level Task Callbacks}
20029 duncan 9
\description{
10
  This provides a way to get the names (or identifiers)
11
  for the currently registered task callbacks
12
  that are invoked at the conclusion of each top-level task.
27625 ripley 13
  These identifiers can be used to remove a callback.
20029 duncan 14
}
17067 duncan 15
\usage{
16
getTaskCallbackNames()
17
}
18
\value{
19
  A character vector giving the name for each of the
20
  registered callbacks which are invoked when
21
  a top-level task is completed successfully.
22
  Each name is the one used when registering
23
  the callbacks and returned as the in the
61433 ripley 24
  call to \code{\link{addTaskCallback}}.
17067 duncan 25
}
26
\note{
20029 duncan 27
  One can use \code{\link{taskCallbackManager}}
28
  to manage user-level task callbacks,
25099 hornik 29
  i.e., S-language functions, entirely within
20029 duncan 30
  the S language and access the names
31
  more directly.
17067 duncan 32
}
33
\seealso{
30912 ripley 34
  \code{\link{addTaskCallback}},
35
  \code{\link{removeTaskCallback}},
87286 smeyer 36
  \code{\link{taskCallbackManager}}
37
 
70260 ripley 38
  \url{https://developer.r-project.org/TaskHandlers.pdf}
17067 duncan 39
}
40
\examples{
30915 ripley 41
 n <- addTaskCallback(function(expr, value, ok, visible) {
47616 ripley 42
                        cat("In handler\n")
43
                        return(TRUE)
44
                      }, name = "simpleHandler")
17067 duncan 45
 
30915 ripley 46
 getTaskCallbackNames()
17067 duncan 47
 
30915 ripley 48
   # now remove it by name
49
 removeTaskCallback("simpleHandler")
17067 duncan 50
 
51
 
30915 ripley 52
 h <- taskCallbackManager()
53
 h$add(function(expr, value, ok, visible) {
47616 ripley 54
                        cat("In handler\n")
55
                        return(TRUE)
56
                      }, name = "simpleHandler")
30915 ripley 57
 getTaskCallbackNames()
58
 removeTaskCallback("R-taskCallbackManager")
17067 duncan 59
}
60
\keyword{environment}