Options
All
  • Public
  • Public/Protected
  • All
Menu

Periodically broadcasts an event to listening LiveEventTarget instances.

Type Parameters

Hierarchy

  • LiveEventTimer

Index

Constructors

Properties

Accessors

Methods

Constructors

  • Creates a new `LiveEventTimer instance.

    Type Parameters

    Parameters

    • eventSource: LiveEventSource<T>

      Event source that will be used to emit events.

    • createEvent: (() => Partial<T>)

      Function used to construct an event to send. This will be called at regular intervals prior to sending an event.

        • (): Partial<T>
        • Returns Partial<T>

    • delay: number

      Period to delay for in milliseconds.

    • repeat: boolean = false

      Optional. If true the timer will repeat once start is called, otherwise a single event will be sent after the delay. Defaults to false.

    Returns LiveEventTimer<T>

Properties

repeat: boolean

If true the event will automatically repeat at an interval specified by the delay.

Accessors

  • get delay(): number
  • set delay(value: number): void
  • get isRunning(): boolean

Methods

  • sendEvent(): void
  • Immediately sends an event.

    remarks

    The createEvent callback to construct the event is called but does not impact any pending timeouts. Call start after calling sendEvent if you'd like to skip the next timer interval.

    Returns void

  • start(): void
  • stop(): void

Generated using TypeDoc