Options
All
  • Public
  • Public/Protected
  • All
Menu

Feedback handler for the XAPI.

Register a feedback listener

xapi.feedback.on('Status/Audio/Volume', data => {
console.log(`Received feedback data: ${data}`);
});

Get the feedback root payload

xapi.feedback.on('Status/Audio/Volume', (data, payload) => {
console.log(`System volume changed to: ${data}`);
JSON.stringify(payload) // => { Status: { Audio: { Volume: data } } }
});

Listen to array elements

xapi.feedback.on('Status/Call[42]/Status', callStatus => {
console.log(`Call status for call number 42 is: ${callStatus}`);
});

Bundle feedback listeners for easy unsubscription

const feedbackGroup = xapi.feedback.group([
xapi.status.on('Audio/Volume', volumeListener),
xapi.status.on('Call', callListener),
]);

// Disable feedback listening for all listeners of the group.
feedbackGroup.off();

Register listener with Array path

const off = xapi.feedback.on('Status/Audio/Volume', listener);
off(); // De-register feedback

Hierarchy

  • default

Index

Constructors

constructor

Properties

Readonly eventEmitter

eventEmitter: EventEmitter = ...
param xapi

XAPI instance.

param interceptor

Feedback interceptor.

Readonly interceptor

interceptor: FeedbackInterceptor = defaultInterceptor

Readonly xapi

xapi: XAPI

Methods

dispatch

  • Dispatches feedback data to the registered handlers.

    Parameters

    • data: any

      JSON data structure of feedback data.

    Returns default

    Returns self for chaining.

group

  • Creates a grouper object which tracks which tracks the feedback paths and listeners being added to it.

    Bundle feedback listeners for easy unsubscription

    // Create a group
    const group = xapi.feedback.group([
    xapi.status.on('Audio Volume', (volume) => {
    // ...
    }),
    xapi.config.on('Audio DefaultVolume', (volume) => {
    // ...
    }),
    ]);

    const handler = xapi.status.on('Call', (call) => { ... });

    // Add handler to the group
    group.add(handler);

    // Remove handler from the group
    group.remove(handler);

    // Unregister from all feedback handlers
    group.off();

    Parameters

    Returns FeedbackGroup

    Proxy object for xapi.feedback.

off

  • off(): void
  • Remove feedback registration.

    deprecated

    use deactivation handler from .on() and .once() instead.

    Returns void

on

  • Registers a feedback listener with the backend service which is invoked when there is feedback matching the subscription query.

    Parameters

    • path: Path

      Path to subscribe to.

    • listener: Listener<any>

      Listener invoked on feedback.

    Returns Registration

    Feedback cancellation function.

once

  • Registers a feedback listener similar to on, but the subscription is removed after the first invocation of the listener.

    Type parameters

    • T = any

    Parameters

    • path: Path

      Path to subscribe to.

    • listener: Listener<any>

      Listener invoked on feedback.

    Returns Registration

    Feedback cancellation function.

Generated using TypeDoc