Countdown Timer - fapnip/openeos GitHub Wiki
Create and display a Countdown Timer
Example:
// Create and display new Timer instance
new Timer({
duration: "3s",
style: "normal",
onTimeout: function() {
new Say('<p>Boo!</p>')
}
})
Required String or Number. If number, number of ms to wait. If string, '1s' = 1 second, '1m' one minute, etc.
Optional string. Default 'normal'
Options:
- normal - Animated countdown timer is displayed while timer is counting down
- secret - Animated spinner is displayed while timer is counting down
- hidden - Nothing is displayed while timer is counting down
Optional Function. Called when timer loop is complete.
Optional Function. Called when all timer loops are complete.
Optional number. Default 1. Number of loops timer will run.
Optional boolean. Default false. Start timer paused.
Return array of all active timer ids
Return timer instance for given id
Cancel timer. Do not run onTimeout or onContinue.
Pause timer.
Resume timer.
Returns true if timer is paused
Return id for given timer instance
Return duration for current timer loop in ms
Return time remaining for current timer loop in ms
Return total number of loops for this timer. 0 = forever (until page change or stop)
Return current loop for this timer, starting with 0
Milovana's EOS editor does not natively support loops for its asynchronous timers.
To make an EOS Timer Action loop for a given number of times in OEOS:
- Turn on the timer's asynchronous mode.
- Add an EVAL action as the first Asynchronous action.
- In that eval action, add as the first line:
// oeos-timer-loops-[number of loop]
For example, to loop forever:
// oeos-timer-loops-0
Or to loop 3 times:
// oeos-timer-loops-3
Or to loop by expression:
// oeos-timer-loops-<eval>myGlobalLoopCountFunction()</eval>