Documentation

Mistake on this page? Email us

Hierarchy

  • Observer<NotificationData>
    • ResourceValuesObserver

Index

Constructors

constructor

Properties

firstValue

firstValue: FirstValueEnum

localPresubscriptions

localPresubscriptions: Array<PresubscriptionObject>

subscribed

subscribed: boolean = true

Methods

addListener

  • addListener(listener: function): this
  • Add a Listener that is invoked when the observer recieves a notification. An observer can have many Listeners.

    Example:

    var myListener = (data) => {
        console.log(data);
    }
    
    observer.addListener(myListener);

    Parameters

    • listener: function

      a listener

        • (data: NotificationData): any
        • Parameters

          • data: NotificationData

          Returns any

    Returns this

addLocalFilter

  • addLocalFilter(filter: function): this
  • Parameters

    • filter: function
        • (filter: NotificationData): boolean
        • Parameters

          • filter: NotificationData

          Returns boolean

    Returns this

clearListeners

  • clearListeners(): this

getNotificationQueue

  • getNotificationQueue(): Array<NotificationData>
  • Get the current notification queue

    Example:

    observer.getNotificationQueue();

    Returns Array<NotificationData>

    list containing the data that has been sent to the observer

listeners

  • listeners(): Array<function>
  • List the callbacks currently registered

    Example:

    observer.listeners();

    Returns Array<function>

    list of listeners

notify

  • notify(data: NotificationData): void
  • Notify this observer

    Parameters

    • data: NotificationData

    Returns void

once

  • once(): Promise<NotificationData>
  • Gets the next value that the observer is notified of

    Example:

    observer.once()
    .then(data => {
        // do something with the data
        console.log(data);
    });

    Returns Promise<NotificationData>

    Promise containing the data

  • once(callback: function): void
  • Gets the next value that the observer is notified of

    Example:

    observer.once(data => {
        // do something with the data
        console.log(data);
    });

    Parameters

    • callback: function

      that is passed the data

        • (data: NotificationData): any
        • Parameters

          • data: NotificationData

          Returns any

    Returns void

removeListener

  • removeListener(listener: function): this
  • Remove a listener

    Example:

    observer.removeListener(myListener);

    Parameters

    • listener: function

      the listener to remove

        • (data: NotificationData): any
        • Parameters

          • data: NotificationData

          Returns any

    Returns this

unsubscribe

  • unsubscribe(): void
  • Stop this observer from recieving notifications

    Returns void