Working with events

Register an handler

WebApp.Net provides some new events to enable you to catch common framework activities.

AddEventListener function

This function is the way to register an event handler. It allows adding more than a single handler for an event.

WebApp.AddEventListener(evt, handler);
Mandatory. The name of the event to listen to. There are currenlty five available events:
Mendatory. The function to call when the event is raised. The handler will received an event object containing contextual informations.
It has the following signature:
The following sample code shows you a very basic usage of this function. For more details, read the description of each event.
function Func1(evt) { alert("Func1 gets called!"); }
function Func2(evt) { alert("Func2 gets called!"); }

WA.AddEventListener("load", Func1);
WA.AddEventListener("load", Func2);

Common event object structure

All events have a common structure shown below:

String. Name of the actual event.
Object. Object which fires the event. Not defined in most cases.
The context of the event. Read event detail for more informations about its content.
Integer. Current client window width.
Integer. Current client window height.

Changes History
20090307v0.5.0RC3CA Removed error, success (use endasync instead)
Added beginasync, willasync, endasync events
20080609v0.3.0CA Added error, success and tabchange events
Added target property
Saturday, 20-Jun-2009 14:39:55 CEST