Documentation

Mistake on this page? Email us

Hierarchy

Index

Constructors

constructor

Properties

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

    Returns this

addLocalFilter

  • addLocalFilter(filter: function): this

clearListeners

  • clearListeners(): this

getNotificationQueue

  • Get the current notification queue

    Example:

    observer.getNotificationQueue();

    Returns Array<DeviceEvent<Resource>>

    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

once

  • 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<DeviceEvent<Resource>>

    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

    Returns void

removeListener

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

    Example:

    observer.removeListener(myListener);

    Parameters

    • listener: function

      the listener to remove

    Returns this

unsubscribe

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

    Returns void