Options
All
  • Public
  • Public/Protected
  • All
Menu

An advanced implementation of a timer class

Type Parameters

  • T = any

Hierarchy

  • AdvancedTimer

Implements

Index

Constructors

  • 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

onEachCountObservable: Observable<ITimerData<T>>

Will notify each time the timer calculates the remaining time

onStateChangedObservable: Observable<TimerState>

Will trigger when the timer state has changed

onTimerAbortedObservable: Observable<ITimerData<T>>

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

onTimerEndedObservable: Observable<ITimerData<T>>

Will trigger when the timer ended successfully

Accessors

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

Methods

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

    Returns void

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

    Returns void

  • 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(): void
  • Will force a stop on the next tick.

    Returns void

Legend

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

Settings

Theme