Zimlet JavaScript API Reference - AjxCallback

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.

Class Summary
Constructor Attributes Constructor Name and Description
 
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
Method Attributes Method Name and Description
 
run()
Runs the callback function, from within the object if there is one.
<static>  
AjxCallback.simpleClosure(func, obj)
This method 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.
Class Detail
AjxCallback(obj, func, args)
Creates a callback which consists of at least a function reference, and possibly also an object to call it from.
Author: Conrad Damon.
Parameters:
{object} obj
the object to call the function from
{function} func
the callback function
{array} args
the default arguments
Method Detail
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:
{array} arg1..argN Optional
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.

<static> AjxCallback.simpleClosure(func, obj)
This method 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"
  };
Parameters:
{function} func
the function
{object} obj
the object to call the function from
{array} arg1...argN Optional
any number of arguments

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:25 GMT-0400 (EDT)