More information on this topic is available in the documentation section: /aw.system.control/setcontroller.html.
function MultipleListeners() {
this._listeners = [];
this._size = 0;
this.addListener = function(fun) {
this._listeners[this._size++] = fun;
}
this.init = function() {
this.addListener(this.callback);
}
this.callback = function() {
alert("hello!");
}
this.handleEvent = function() {
for(var i=0;i<this._size;i++) this._listeners[i].call();
}
this.init();
}
var v1 = new MultipleListeners();
function callback01() {
alert("01");
}
function callback02() {
alert("02");
}
v1.addListener(callback01);
v1.addListener(callback02);
v1.handleEvent();
Hope this help.// 2 listeners
public class Father {
public void printMe() {
System.out.println("father! yeah, its me!");
}
}
public class Child extends Father {
public void printMe() {
System.out.println("oh... its the child! Where re my father?");
super.printMe();
}
}
// main class
Father father = new Father();
Father child = new Child();
child.printMe();
obj.onCellMouseOver = eventHandlerFunction;
There is also another method, intended for the control developer, where you can attach/remove/replace a group of related event handlers, called 'controller'. The controller is just an assosiative array of eventName:eventHandlerFunction pairsvar mouseController = {
onCellMouseOver: function1,
onCellMouseOut: function2
};
You can assign the controller using setController(name, controllerObject) method -obj.setController("mouse", mouseController);
Several controllers can contain handlers for the same event, in this case all of them will be executed. The event handler attached directly to the object will be executed first and returning non-zero error code will cancel execution of event handlers in the controllers.var keyboardController = {
onKeyLeft: "selectPreviousCell",
onKeyRight: "selectNextCell"
};
var selectionController = {
selectPreviousCell: function1,
selectNextCell: function2
};
