Constructor
new TimerTask()
Methods
cancel() → {boolean}
Cancels the task.
Returns:
true
if this task was scheduled for one-time execution
and has not yet run, or this task was scheduled for repeated execution.
Return false
if the task was scheduled for one-time execution and has
already run, or if the task was never scheduled, or if the task was
already cancelled.
- Type
- boolean
(abstract) run()
Runs the task.
scheduledExecutionTime() → {number}
Returns scheduled execution time of the most recent actual execution of this task.
Example usage:
run() {
if (Date.now() - scheduledExecutionTime() >= MAX_TARDINESS) {
return; // Too late; skip this execution.
}
// Perform the task
}
Returns:
The time in milliseconds since the epoch, undefined if the task has not yet run for the first time.
- Type
- number