|
|
|
|
Wildfire EventsFrom $1Table of contentsWildfire sharing tool generates many different events for various situations which are driven by user interactions. For example, when the user posts content to her own profile. A program may listen to events which are relevant to it. A program interested in certain events may register event handlers for those events and execute code when those events are received.
In this section you will learn how to: define events handlers and register for events.
Please refer to the Events page in the API Reference, for a full reference of the various Events generated by Wildfire.
Defining an Event HandlerAn Event Handler is a function that receives a single "event object" parameter, having the following signature:
The "eventObj" object includes members, which correspond to the specific event that was fired.
For example - for Email Event, the eventObj will include the following members:
The following members of the event object are available for all events:
The Events page, includes the specification of the event object fields for each event.
Event Handler Example:
JavaScript ActionScript2 ActionScript3
function displayEventMessage(eventObj) {
// handle the event
alert(eventObj.type + ' event fired! module ID=' + eventObj.ModuleID);
}
Registering a Handler for an EventRegistering a Handler for an event is performed as part of the Wildfire configuration. The Wildfire configuration object includes several parameters for registering event handlers:
Each of the above parameters may be assigned a value, which is the Event Handler function name, that will be called whenever the corresponding event occurs. Example:Assuming your configuration object name is 'conf' conf['onPostProfile']= displayEventMessage;
In this example we register the "post profile" event to the 'displayEventMessage' function. This means - that whenever the user posts content to his profile, the displayEventMessage function will be called, and it will receive the eventObj parameter enfolding - the type property (which, in this case is "postProfile") and the ModuleID. Notes:
JavaScript ActionScript2 ActionScript3
conf['onLoad'] = function(eventObj) {
alert(eventObj.type + ' event fired! module ID=' + eventObj.ModuleID);
}
< Back to 'UI Configuration' | Next to 'Post to Social Network' >
Tags:
|
|||||||||||||||
|