Class AdvancedTimer<T>
Type Parameters
- T = any
Implements
Constructors
constructor
-
Will construct a new advanced timer based on the options provided. Timer will not start until start() is called.
Type Parameters
- T = any
Parameters
- options: ITimerOptions<T>
construction options for this advanced timer
Returns AdvancedTimer<T>
Properties
on Each Count Observable
Will notify each time the timer calculates the remaining time
on State Changed Observable
Will trigger when the timer state has changed
on Timer Aborted Observable
Will trigger when the timer was aborted due to the break condition
on Timer Ended Observable
Will trigger when the timer ended successfully
Accessors
break Condition
-
set a breaking condition for this timer. Default is to never break during count
Parameters
- predicate: (data: ITimerData<T>) => boolean
the new break condition. Returns true to break, false otherwise
Returns void
- predicate: (data: ITimerData<T>) => boolean
Methods
clear Observables
-
Reset ALL associated observables in this advanced timer
Returns void
dispose
-
Dispose this timer, clearing all resources
Returns void
start
-
Will start a new iteration of this timer. Only one instance of this timer can run at a time.
Parameters
- timeToEnd: number = ...
how much time to measure until timer ended
Returns void
- timeToEnd: number = ...
stop
-
Will force a stop on the next tick.
Returns void
An advanced implementation of a timer class