Class AjxCallback
Object
|
+--AjxCallback
-
Direct Known Subclasses:
-
AjxTimedAction
- class
AjxCallback
This class represents a callback function which can be called standalone, or from a
given object. What the callback takes as arguments and what it returns are left to the
client.
Defined in AjxCallback.js
Author: Conrad Damon
Constructor Summary |
AjxCallback
(obj, func, args)
Creates a callback which consists of at least a function reference, and possibly also
an object to call it from.
|
Method Summary |
Object
|
run()
Runs the callback function, from within the object if there is one.
|
Object
|
toString()
|
<static> Object
|
simpleClosure(func, obj)
The following function is what an AjxCallback should be *all* about.
|
args
Object args
func
Object func
obj
Object obj
AjxCallback
AjxCallback(obj, func, args)
Creates a callback which consists of at least a function reference, and possibly also
an object to call it from.
Parameters:
obj
- [Object] the object to call the function from
func
- [function] the callback function
args
- [primitive or Array] default arguments
run
Object run()
Runs the callback function, from within the object if there is one. The
called function passed arguments are the concatenation of the argument
array passed to this object's constructor and the argument array passed
to the run
method. Whatever the called function returns is
returned to the caller.
Parameters:
arg1
- The first argument which will be appended to the argument array passed to this object's constructor. Any number of arguments may be passed to the run
method.
toString
Object toString()
simpleClosure
<static> Object simpleClosure(func, obj)
The following function is what an AjxCallback should be *all* about. It
returns a plain function that will call your supplied "func" in the context
of "obj" and pass to it, in this order, any additional arguments that you
pass to simpleClosure and the arguments that were passed to it at the call
time.
An example should do:
div.onclick = AjxCallback.simpleClosure(this.handler, this, "some data");
...
this.handler = function(data, event) {
// event will be passed for DOM2 compliant browsers
// and data is "some data"
};
[this is one of the most useful functions I ever wrote :D -mihai
Documentation generated by
JSDoc on Thu Apr 27 13:58:41 2006