File: make_calling_handler.R

package info (click to toggle)
r-cran-progressr 0.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,184 kB
  • sloc: sh: 13; makefile: 7
file content (15 lines) | stat: -rw-r--r-- 364 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
make_calling_handler <- function(handlers) {
  if (length(handlers) > 1L) {
    calling_handler <- function(p) {
      finished <- FALSE
      for (kk in seq_along(handlers)) {
        handler <- handlers[[kk]]
        if (handler(p)) finished <- TRUE
      }
      invisible(finished)
    }
  } else {
    calling_handler <- handlers[[1]]
  }
  calling_handler
}