Newer Version Available

This content describes an older version of this product. View Latest

Subscribing to Events

The following code example shows how to call the subscribe method within a Visualforce page to subscribe to specified events published from a canvas app.

1// Subscribe to a single event.
2Sfdc.canvas.controller.subscribe({name : 'mynamespace.myevent0', 
3                                  onData : function (e) {}});
4
5// Subscribe to multiple events in a single call.
6Sfdc.canvas.controller.subscribe([
7    {name : 'mynamespace.myevent1', onData : function(e) {}},
8    {name : 'mynamespace.myevent2', onData : function(e) {}}
9]);