Add listener to the dispatcher's event named type.
Calls every listeners registered to type event.
Remove all listeners. If type is specified, remove all listeners of type.
Remove the listener from the dispatcher.
Returns true if listener is removed, otherwise returns false.
Starts the timer.
Stop the timer.
Generated using TypeDoc
A timer which calls callback function on every ticks.
const timer = new Timer(1000); // every 1000ms timer.addEventListener('tick', ()=> console.log('Hello!'); timer.start();You can create an once timer.
const timer = new Timer(1000, { once: true }); timer.addEventListener('tick', ()=> console.log('Hello!'); timer.start();Note: You should call
addEventListenerbefore start the timer. Otherwise, the timer may fire tick event without listeners.