Interface ITimerOptions<T>
interface ITimerOptions<T> {
breakCondition?: (data?: ITimerData<T>) => boolean;
contextObservable: Observable<T>;
observableParameters?: {
insertFirst?: boolean;
mask?: number;
scope?: any;
};
onAborted?: (data: ITimerData<any>) => void;
onEnded?: (data: ITimerData<any>) => void;
onTick?: (data: ITimerData<any>) => void;
timeout: number;
}
breakCondition?: (data?: ITimerData<T>) => boolean;
contextObservable: Observable<T>;
observableParameters?: {
insertFirst?: boolean;
mask?: number;
scope?: any;
};
onAborted?: (data: ITimerData<any>) => void;
onEnded?: (data: ITimerData<any>) => void;
onTick?: (data: ITimerData<any>) => void;
timeout: number;
}
Type Parameters
- T
Index
Properties
Optionalbreak Condition
An optional break condition that will stop the times prematurely. In this case onEnded will not be triggered!
context Observable
The context observable is used to calculate time deltas and provides the context of the timer's callbacks. Will usually be OnBeforeRenderObservable. Countdown calculation is done ONLY when the observable is notifying its observers, meaning that if you choose an observable that doesn't trigger too often, the wait time might extend further than the requested max time
Optionalobservable Parameters
observableParameters?: { insertFirst?: boolean; mask?: number; scope?: any }
Optional parameters when adding an observer to the observable
Optionalon Aborted
Will be triggered when the break condition has met (prematurely ended)
Optionalon Ended
Will be triggered when the time condition has met
Optionalon Tick
Optional function to execute on each tick (or count)
timeout
timeout: number
Time-to-end
Construction options for a timer