Represents a subscription.
As a best practice, events should be bound by using on
or once
before calling subscribe
. There may be events that fire before
the IPromise
returned from subscribe
is resolved.
Methods
dispose()
Informs the application that this object is no longer required and can be cleaned up. No further function calls from this instance will be accepted by the application.
off(key[, handler]) :ININ.Addins.IEventHandler
Unbinds the optionally specified handler from the event key.
Inherited from ININ.Addins.IEventHandler#off
Parameters
Name | Type | Description |
---|---|---|
key | String |
The event key. |
handler | function |
The callback handler. |
Returns
This ININ.Addins.IEventHandler
instance.
on(key, handler) :ININ.Addins.IEventHandler
Binds the specified event key to the callback that can be emitted 1 or more times.
Inherited from ININ.Addins.IEventHandler#on
Parameters
Name | Type | Description |
---|---|---|
key | String |
The event key. |
handler | function |
The callback handler. |
Returns
This ININ.Addins.IEventHandler
instance.
once(key, handler) :ININ.Addins.IEventHandler
Binds the specified event key to the callback that can be emitted only once, then removed.
Inherited from ININ.Addins.IEventHandler#once
Parameters
Name | Type | Description |
---|---|---|
key | String |
The event key. |
handler | function |
The callback handler. |
Returns
This ININ.Addins.IEventHandler
instance.
subscribe(args) :IPromise
Creates or updates the subscription owned by this instance.
The application must be connected to Interaction Center. Callers can verify the connection by inspecting
the ININ.Addins.IC.sessionInfo
object.
Parameters
Name | Type | Description |
---|---|---|
args | object |
The subscription request. This is dependent on each kind of subscription. |
Returns
A IPromise
that is resolved when the subscription is created or updated.
- Type
- IPromise
unsubscribe() :IPromise
Removes the subscription owned by this instance.
Returns
A IPromise
that is resolved when the subscription is removed.
- Type
- IPromise