Basic timer widget
Calls FUN every ms/1000 seconds. A timer is stopped through its stop_timer method which is called using OO style: obj$stop_timer().
S3 generic for dispatch
gtimer(ms, FUN, data = NULL, one.shot = FALSE, start = TRUE, toolkit = guiToolkit()) .gtimer(toolkit, ms, FUN, data = NULL, one.shot = FALSE, start = TRUE)
ms |
interval in milliseconds |
FUN |
FUnction to call. Has one argument, data passed in |
data |
passed to function |
one.shot |
logical. If TRUE, called just once, else repeats |
start |
logical. If FALSE, started by |
toolkit |
gui toolkit to dispatch into |
## Not run:
i <- 0
FUN <- function(data) {i <<- i + 1; if(i > 10) a$stop_timer(); print(i)}
a <- gtimer(1000, FUN)
##
## a one shot timer is run only once
FUN <- function(data) message("Okay, I can breathe now")
hold_breath <- gtimer(1000*60, FUN, one.shot=TRUE)
## End(Not run)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.