Class PubSub
Defined in: jspdf.js.
Constructor Attributes | Constructor Name and Description |
---|---|
PubSub()
PubSub implementation
|
Method Attributes | Method Name and Description |
---|---|
publish(topic, **args)
Allows caller to emit an event and pass arguments to event listeners.
|
|
subscribe(topic, callback, once)
Allows listener code to subscribe to channel and be called when data is available
|
|
unsubscribe(token)
Allows listener code to unsubscribe from a channel
|
Method Detail
publish(topic, **args)
Allows caller to emit an event and pass arguments to event listeners.
- Parameters:
- topic
- {String} Name of the channel on which to voice this event
- **args
- Any number of arguments you want to pass to the listeners of this event.
{Object}
subscribe(topic, callback, once)
Allows listener code to subscribe to channel and be called when data is available
- Parameters:
- topic
- {String} Name of the channel on which to voice this event
- callback
- {Function} Executable (function pointer) that will be ran when event is voiced on this channel.
- once
- {Boolean} (optional. False by default) Flag indicating if the function is to be triggered only once.
- Returns:
- {Object} A token object that cen be used for unsubscribing.
unsubscribe(token)
Allows listener code to unsubscribe from a channel
- Parameters:
- token
- {Object} A token object that was returned by `subscribe` method