You are not logged in.   Log in | Register

Wildfire Events

From $1

Wildfire 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 Handler

An Event Handler is a function that receives a single "event object" parameter, having the following signature:

 

 JavaScript  ActionScript2  ActionScript3 
function eventHandlerName(eventObj)

 

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:

Field Type Description
type string The name of the event: "email".
ModuleID string The ID of the module that triggered the event.
recipients Array An array of objects that each has a name property and an email property corresponding to the recipients of the email that was sent.
senderName string The sender's name, as he entered in the Wildfire UI.

 

The following members of the event object are available for all events:

  • type property - the name of the event fired.
  • ModuleID property - with the wildfire instance ModuleID and additional properties depending on the specific event.

 

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 Event

Registering a Handler for an event is performed as part of the Wildfire configuration. The Wildfire configuration object includes several parameters for registering event handlers:

  • onLoad
  • onPostProfile
  • onClose
  • onEmail
  • onRenderDone
  • onNetworkButtonClicked
  • onCopy

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:

  • Several events may be registered to one Event Handler (function).

 

  • Event Handlers may be defined inline. For Example:
 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:
Files (0)