Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AdvancedTimer<T>

An advanced implementation of a timer class

Type parameters

  • T = any

Hierarchy

  • AdvancedTimer

Implements

Index

Constructors

constructor

  • Will construct a new advanced timer based on the options provided. Timer will not start until start() is called.

    Parameters

    • options: ITimerOptions<T>

      construction options for this advanced timer

    Returns AdvancedTimer

Properties

onEachCountObservableSearch playground for onEachCountObservable

onEachCountObservable: Observable<ITimerData<T>>

Will notify each time the timer calculates the remaining time

onStateChangedObservableSearch playground for onStateChangedObservable

onStateChangedObservable: Observable<TimerState>

Will trigger when the timer state has changed

onTimerAbortedObservableSearch playground for onTimerAbortedObservable

onTimerAbortedObservable: Observable<ITimerData<T>>

Will trigger when the timer was aborted due to the break condition

onTimerEndedObservableSearch playground for onTimerEndedObservable

onTimerEndedObservable: Observable<ITimerData<T>>

Will trigger when the timer ended successfully

Accessors

breakCondition

  • set breakCondition(predicate: (data: ITimerData<T>) => boolean): any
  • 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 any

Methods

clearObservablesSearch playground for clearObservables

  • clearObservables(): void
  • Reset ALL associated observables in this advanced timer

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Dispose this timer, clearing all resources

    Returns void

startSearch playground for start

  • start(timeToEnd?: number): void
  • Will start a new iteration of this timer. Only one instance of this timer can run at a time.

    Parameters

    • Optional timeToEnd: number

      how much time to measure until timer ended

    Returns void

stopSearch playground for stop

  • stop(): void
  • Will force a stop on the next tick.

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method