AdvancedTimer<T>

An advanced implementation of a timer class

Type parameters

  • T

Hierarchy

  • AdvancedTimer

Implements

Index

Constructors

constructor

Find examples in Playground
  • 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

onEachCountObservable

Find examples in Playground
onEachCountObservable: Observable<ITimerData<T>>

Will notify each time the timer calculates the remaining time

onStateChangedObservable

Find examples in Playground
onStateChangedObservable: Observable<TimerState>

Will trigger when the timer state has changed

onTimerAbortedObservable

Find examples in Playground
onTimerAbortedObservable: Observable<ITimerData<T>>

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

onTimerEndedObservable

Find examples in Playground
onTimerEndedObservable: Observable<ITimerData<T>>

Will trigger when the timer ended successfully

Accessors

breakCondition

Find examples in Playground
  • set breakCondition(predicate: function): any
  • set a breaking condition for this timer. Default is to never break during count

    Parameters

    • predicate: function

      the new break condition. Returns true to break, false otherwise

    Returns any

Methods

clearObservables

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

    Returns void

dispose

Find examples in Playground
  • dispose(): void
  • Dispose this timer, clearing all resources

    Returns void

start

Find examples in Playground
  • 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

stop

Find examples in Playground
  • stop(): void
  • Will force a stop on the next tick.

    Returns void

Generated using TypeDoc