Options
All
  • Public
  • Public/Protected
  • All
Menu

Simple Observable implementation

Type parameters

  • T

    is the typescript Type that defines the data being observed

Hierarchy

Index

Constructors

Properties

observers: Util.Observer<T>[] = []
subscriptions: ((val: T) => any)[] = []

Methods

  • clear(): void
  • notifyAll(message: T): void
  • Broadcasts a message to all observers and callbacks

    Parameters

    • message: T

    Returns void

  • subscribe(func: (val: T) => any): void
  • Register a callback to listen to this observable

    Parameters

    • func: (val: T) => any
        • (val: T): any
        • Parameters

          • val: T

          Returns any

    Returns void

  • unsubscribe(func: (val: T) => any): void
  • Remove a callback that is listening to this observable

    Parameters

    • func: (val: T) => any
        • (val: T): any
        • Parameters

          • val: T

          Returns any

    Returns void