.setCallback()
(Last Updated On: April 11, 2013)
Overview

Hook a function onto a SnapEngage JavaScript Event

SnapEngage.setCallback(eventName, function (eventParameters) {
    // Do stuff.
});


Parameters


eventName
Type
String | (Required)
Values
See SnapEngage JavaScript Events.
Description
The event on which to fire the function.

function (eventParameters)
Type
Varies. Depends on Event.
Description
The event parameters are provided by the event being hooked in the eventName and are usable within the anonymous function.
For example, the ‘OpenProactive’ event provides two event parameters, so you might use:

SnapEngage.setCallback('OpenProactive', function (agent, msg) {
    console.log(agent); 
    console.log(msg); 
});

For more examples please see our Event Documentation.