JsDoc Reference - PubSub

Class Index | File Index

## Classes

- _global_
- FontObject
- jsPDF
- PubSub

# Class PubSub

Defined in: jspdf.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| PubSub() PubSub implementation

Method Summary
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

Class Detail
PubSub()
PubSub implementation
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

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Oct 15 2012 22:41:49 GMT-0700 (PDT)