Path: blob/main/projects/HexGL/libs/Editor_files/class.js
4627 views
/**1* gamecore.js - Copyright 2012 Playcraft Labs, Inc. (see licence.txt)2* class.js3* Classes and objects4*/56/**7* @Class8* A modified version of class.js to cater to static inheritance and deep object cloning9* Based almost completely on class.js (Javascript MVC -- Justin Meyer, Brian Moschel, Michael Mayer and others)10* (http://javascriptmvc.com/contribute.html)11* Some portions adapted from Prototype JavaScript framework, version 1.6.0.1 (c) 2005-2007 Sam Stephenson12* <p>13* Class system for javascript14* <p>15* <code>16* var Fighter = gamecore.Base.extend('Fighter',17* {18* // static (this is inherited as well)19* firingSpeed: 100020* },21* {22* // instance23*24* hp: 0,25* lastFireTime: 0,26*27* init: function(hp)28* {29* this.hp = hp;30* },31*32* fire: function()33* {34* this._super(); // super methods!35*36* // do firing!37* }38* });39*40* var gunship = new Fighter(100);41* </code>42*43* Introspection:44* <code>45* gamecore.Base.extend(‘Fighter.Gunship’);46* Fighter.Gunship.shortName; // ‘Gunship’47* Fighter.Gunship.fullName; // ‘Fighter.Gunship’48* Fighter.Gunship.namespace; // ‘Fighter’49* </code>50* <p>51* Setup method will be called prior to any init -- nice if you want to do things without needing the52* users to call _super in the init, as well as for normalizing parameters.53* <code>54* setup: function()55* {56* this.objectId = this.Class.totalObjects++;57* this.uniqueId = this.Class.fullName + ':' + this.objectId;58* }59* </code>60*/6162// compatible with jquery classing63(function ($)64{65var regs = {66undHash: /_|-/,67colons: /::/,68words: /([A-Z]+)([A-Z][a-z])/g,69lowUp: /([a-z\d])([A-Z])/g,70dash: /([a-z\d])([A-Z])/g,71replacer: /\{([^\}]+)\}/g,72dot: /\./73},74getNext = function (current, nextPart, add)75{76return current[nextPart] || ( add && (current[nextPart] = {}) );77},78isContainer = function (current)79{80var type = typeof current;81return type && ( type == 'function' || type == 'object' );82},83getObject = function (objectName, roots, add)84{85var parts = objectName ? objectName.split(regs.dot) : [],86length = parts.length,87currents = $.isArray(roots) ? roots : [roots || window],88current,89ret,90i,91c = 0,92type;9394if (length == 0)95{96return currents[0];97}98while (current = currents[c++])99{100for (i = 0; i < length - 1 && isContainer(current); i++)101{102current = getNext(current, parts[i], add);103}104if (isContainer(current))105{106107ret = getNext(current, parts[i], add);108109if (ret !== undefined)110{111112if (add === false)113{114delete current[parts[i]];115}116return ret;117118}119120}121}122},123124/**125* @class jQuery.String126*127* A collection of useful string helpers.128*129*/130str = $.String = $.extend($.String || {}, {131/**132* @function133* Gets an object from a string.134* @param {String} name the name of the object to look for135* @param {Array} [roots] an array of root objects to look for the name136* @param {Boolean} [add] true to add missing objects to137* the path. false to remove found properties. undefined to138* not modify the root object139*/140getObject: getObject,141/**142* Capitalizes a string143* @param {String} s the string.144* @return {String} a string with the first character capitalized.145*/146capitalize: function (s, cache)147{148return s.charAt(0).toUpperCase() + s.substr(1);149},150/**151* Capitalizes a string from something undercored. Examples:152* @codestart153* jQuery.String.camelize("one_two") //-> "oneTwo"154* "three-four".camelize() //-> threeFour155* @codeend156* @param {String} s157* @return {String} a the camelized string158*/159camelize: function (s)160{161s = str.classize(s);162return s.charAt(0).toLowerCase() + s.substr(1);163},164/**165* Like camelize, but the first part is also capitalized166* @param {String} s167* @return {String} the classized string168*/169classize: function (s, join)170{171var parts = s.split(regs.undHash),172i = 0;173for (; i < parts.length; i++)174{175parts[i] = str.capitalize(parts[i]);176}177178return parts.join(join || '');179},180/**181* Like [jQuery.String.classize|classize], but a space separates each 'word'182* @codestart183* jQuery.String.niceName("one_two") //-> "One Two"184* @codeend185* @param {String} s186* @return {String} the niceName187*/188niceName: function (s)189{190return str.classize(s, ' ');191},192193/**194* Underscores a string.195* @codestart196* jQuery.String.underscore("OneTwo") //-> "one_two"197* @codeend198* @param {String} s199* @return {String} the underscored string200*/201underscore: function (s)202{203return s.replace(regs.colons, '/').replace(regs.words, '$1_$2').replace(regs.lowUp, '$1_$2').replace(regs.dash, '_').toLowerCase();204},205/**206* Returns a string with {param} replaced values from data.207*208* $.String.sub("foo {bar}",{bar: "far"})209* //-> "foo far"210*211* @param {String} s The string to replace212* @param {Object} data The data to be used to look for properties. If it's an array, multiple213* objects can be used.214* @param {Boolean} [remove] if a match is found, remove the property from the object215*/216sub: function (s, data, remove)217{218var obs = [];219obs.push(s.replace(regs.replacer, function (whole, inside)220{221//convert inside to type222var ob = getObject(inside, data, typeof remove == 'boolean' ? !remove : remove),223type = typeof ob;224if ((type === 'object' || type === 'function') && type !== null)225{226obs.push(ob);227return "";228} else229{230return "" + ob;231}232}));233return obs.length <= 1 ? obs[0] : obs;234}235});236237})(jQuery);238(function ($)239{240241// if we are initializing a new class242var initializing = false,243makeArray = $.makeArray,244isFunction = $.isFunction,245isArray = $.isArray,246extend = $.extend,247248/**249*250*/251cloneObject = function(object)252{253if (!object || typeof(object) != 'object')254return object;255256// special case handling of array (deep copy them)257if (object instanceof Array)258{259var clone = [];260for (var c = 0; c < object.length; c++)261clone[c] = cloneObject(object[c]);262return clone;263}264else // otherwise, it's a normal object, clone it's properties265{266var cloneObj = {};267for (var prop in object)268cloneObj[prop] = cloneObject(object[prop]);269return cloneObj;270}271},272273concatArgs = function (arr, args)274{275return arr.concat(makeArray(args));276},277// tests if we can get super in .toString()278fnTest = /xyz/.test(function ()279{280xyz;281}) ? /\b_super\b/ : /.*/,282// overwrites an object with methods, sets up _super283// newProps - new properties284// oldProps - where the old properties might be285// addTo - what we are adding to286inheritProps = function (newProps, oldProps, addTo)287{288addTo = addTo || newProps289for (var name in newProps)290{291// Check if we're overwriting an existing function292addTo[name] = isFunction(newProps[name]) &&293isFunction(oldProps[name]) &&294fnTest.test(newProps[name]) ? (function (name, fn)295{296return function ()297{298var tmp = this._super, ret;299300// Add a new ._super() method that is the same method but on the super-class301this._super = oldProps[name];302303// The method only need to be bound temporarily, so we remove it when we're done executing304ret = fn.apply(this, arguments);305this._super = tmp;306return ret;307};308})(name, newProps[name]) : newProps[name];309}310},311312313/**314* @class jQuery.Class315* @plugin jquery/class316* @tag core317* @download dist/jquery/jquery.class.js318* @test jquery/class/qunit.html319*320* Class provides simulated inheritance in JavaScript. Use clss to bridge the gap between321* jQuery's functional programming style and Object Oriented Programming. It322* is based off John Resig's [http://ejohn.org/blog/simple-javascript-inheritance/|Simple Class]323* Inheritance library. Besides prototypal inheritance, it includes a few important features:324*325* - Static inheritance326* - Introspection327* - Namespaces328* - Setup and initialization methods329* - Easy callback function creation330*331*332* ## Static v. Prototype333*334* Before learning about Class, it's important to335* understand the difference between336* a class's __static__ and __prototype__ properties.337*338* //STATIC339* MyClass.staticProperty //shared property340*341* //PROTOTYPE342* myclass = new MyClass()343* myclass.prototypeMethod() //instance method344*345* A static (or class) property is on the Class constructor346* function itself347* and can be thought of being shared by all instances of the348* Class. Prototype propertes are available only on instances of the Class.349*350* ## A Basic Class351*352* The following creates a Monster class with a353* name (for introspection), static, and prototype members.354* Every time a monster instance is created, the static355* count is incremented.356*357* @codestart358* $.Class.extend('Monster',359* /* @static *|360* {361* count: 0362* },363* /* @prototype *|364* {365* init: function( name ) {366*367* // saves name on the monster instance368* this.name = name;369*370* // sets the health371* this.health = 10;372*373* // increments count374* this.Class.count++;375* },376* eat: function( smallChildren ){377* this.health += smallChildren;378* },379* fight: function() {380* this.health -= 2;381* }382* });383*384* hydra = new Monster('hydra');385*386* dragon = new Monster('dragon');387*388* hydra.name // -> hydra389* Monster.count // -> 2390* Monster.shortName // -> 'Monster'391*392* hydra.eat(2); // health = 12393*394* dragon.fight(); // health = 8395*396* @codeend397*398*399* Notice that the prototype <b>init</b> function is called when a new instance of Monster is created.400*401*402* ## Inheritance403*404* When a class is extended, all static and prototype properties are available on the new class.405* If you overwrite a function, you can call the base class's function by calling406* <code>this._super</code>. Lets create a SeaMonster class. SeaMonsters are less407* efficient at eating small children, but more powerful fighters.408*409*410* Monster.extend("SeaMonster",{411* eat: function( smallChildren ) {412* this._super(smallChildren / 2);413* },414* fight: function() {415* this.health -= 1;416* }417* });418*419* lockNess = new SeaMonster('Lock Ness');420* lockNess.eat(4); //health = 12421* lockNess.fight(); //health = 11422*423* ### Static property inheritance424*425* You can also inherit static properties in the same way:426*427* $.Class.extend("First",428* {429* staticMethod: function() { return 1;}430* },{})431*432* First.extend("Second",{433* staticMethod: function() { return this._super()+1;}434* },{})435*436* Second.staticMethod() // -> 2437*438* ## Namespaces439*440* Namespaces are a good idea! We encourage you to namespace all of your code.441* It makes it possible to drop your code into another app without problems.442* Making a namespaced class is easy:443*444* @codestart445* $.Class.extend("MyNamespace.MyClass",{},{});446*447* new MyNamespace.MyClass()448* @codeend449* <h2 id='introspection'>Introspection</h2>450* Often, it's nice to create classes whose name helps determine functionality. Ruby on451* Rails's [http://api.rubyonrails.org/classes/ActiveRecord/Base.html|ActiveRecord] ORM class452* is a great example of this. Unfortunately, JavaScript doesn't have a way of determining453* an object's name, so the developer must provide a name. Class fixes this by taking a String name for the class.454* @codestart455* $.Class.extend("MyOrg.MyClass",{},{})456* MyOrg.MyClass.shortName //-> 'MyClass'457* MyOrg.MyClass.fullName //-> 'MyOrg.MyClass'458* @codeend459* The fullName (with namespaces) and the shortName (without namespaces) are added to the Class's460* static properties.461*462*463* <h2>Setup and initialization methods</h2>464* <p>465* Class provides static and prototype initialization functions.466* These come in two flavors - setup and init.467* Setup is called before init and468* can be used to 'normalize' init's arguments.469* </p>470* <div class='whisper'>PRO TIP: Typically, you don't need setup methods in your classes. Use Init instead.471* Reserve setup methods for when you need to do complex pre-processing of your class before init is called.472*473* </div>474* @codestart475* $.Class.extend("MyClass",476* {477* setup: function() {} //static setup478* init: function() {} //static constructor479* },480* {481* setup: function() {} //prototype setup482* init: function() {} //prototype constructor483* })484* @codeend485*486* <h3>Setup</h3>487* <p>Setup functions are called before init functions. Static setup functions are passed488* the base class followed by arguments passed to the extend function.489* Prototype static functions are passed the Class constructor function arguments.</p>490* <p>If a setup function returns an array, that array will be used as the arguments491* for the following init method. This provides setup functions the ability to normalize492* arguments passed to the init constructors. They are also excellent places493* to put setup code you want to almost always run.</p>494* <p>495* The following is similar to how [jQuery.Controller.prototype.setup]496* makes sure init is always called with a jQuery element and merged options497* even if it is passed a raw498* HTMLElement and no second parameter.499* </p>500* @codestart501* $.Class.extend("jQuery.Controller",{502* ...503* },{504* setup: function( el, options ) {505* ...506* return [$(el),507* $.extend(true,508* this.Class.defaults,509* options || {} ) ]510* }511* })512* @codeend513* Typically, you won't need to make or overwrite setup functions.514* <h3>Init</h3>515*516* <p>Init functions are called after setup functions.517* Typically, they receive the same arguments518* as their preceding setup function. The Foo class's <code>init</code> method519* gets called in the following example:520* </p>521* @codestart522* $.Class.Extend("Foo", {523* init: function( arg1, arg2, arg3 ) {524* this.sum = arg1+arg2+arg3;525* }526* })527* var foo = new Foo(1,2,3);528* foo.sum //-> 6529* @codeend530* <h2>Callbacks</h2>531* <p>Similar to jQuery's proxy method, Class provides a532* [jQuery.Class.static.callback callback]533* function that returns a callback to a method that will always534* have535* <code>this</code> set to the class or instance of the class.536* </p>537* The following example uses this.callback to make sure538* <code>this.name</code> is available in <code>show</code>.539* @codestart540* $.Class.extend("Todo",{541* init: function( name ) { this.name = name }542* get: function() {543* $.get("/stuff",this.callback('show'))544* },545* show: function( txt ) {546* alert(this.name+txt)547* }548* })549* new Todo("Trash").get()550* @codeend551* <p>Callback is available as a static and prototype method.</p>552*553* <h2>Typing<h2>554* Classes are automatically populating with three type related components:555*556* _types: a variable that contains an array of types of this class (extends history)557* _fullTypeName: a string representation of the extends hierarchy558* isA(string): a function you can call which will return true if the class is of a given type string.559* <p>560* Example:561* <p>562* Animal.extend('Tiger', {}, {});563* Tiger._types; // ['Animal', 'Tiger']564* Tiger._fullTypeName; // 'Animal | Tiger |"565* Tiger.isA('Animal'); // true566* </p>567* @constructor Creating a new instance of an object that has extended jQuery.Class568* calls the init prototype function and returns a new instance of the class.569*570*/571572clss = $.Class = function ()573{574if (arguments.length)575{576return clss.extend.apply(clss, arguments);577}578};579580/* @Static*/581extend(clss, {582/**583* @function callback584* Returns a callback function for a function on this Class.585* The callback function ensures that 'this' is set appropriately.586* @codestart587* $.Class.extend("MyClass",{588* getData: function() {589* this.showing = null;590* $.get("data.json",this.callback('gotData'),'json')591* },592* gotData: function( data ) {593* this.showing = data;594* }595* },{});596* MyClass.showData();597* @codeend598* <h2>Currying Arguments</h2>599* Additional arguments to callback will fill in arguments on the returning function.600* @codestart601* $.Class.extend("MyClass",{602* getData: function( <b>callback</b> ) {603* $.get("data.json",this.callback('process',<b>callback</b>),'json');604* },605* process: function( <b>callback</b>, jsonData ) { //callback is added as first argument606* jsonData.processed = true;607* callback(jsonData);608* }609* },{});610* MyClass.getData(showDataFunc)611* @codeend612* <h2>Nesting Functions</h2>613* Callback can take an array of functions to call as the first argument. When the returned callback function614* is called each function in the array is passed the return value of the prior function. This is often used615* to eliminate currying initial arguments.616* @codestart617* $.Class.extend("MyClass",{618* getData: function( callback ) {619* //calls process, then callback with value from process620* $.get("data.json",this.callback(['process2',callback]),'json')621* },622* process2: function( type,jsonData ) {623* jsonData.processed = true;624* return [jsonData];625* }626* },{});627* MyClass.getData(showDataFunc);628* @codeend629* @param {String|Array} fname If a string, it represents the function to be called.630* If it is an array, it will call each function in order and pass the return value of the prior function to the631* next function.632* @return {Function} the callback function.633*/634callback: function (funcs)635{636//args that should be curried637var args = makeArray(arguments),638self;639640funcs = args.shift();641642if (!isArray(funcs))643{644funcs = [funcs];645}646647self = this;648649return function class_cb()650{651var cur = concatArgs(args, arguments),652isString,653length = funcs.length,654f = 0,655func;656657for (; f < length; f++)658{659func = funcs[f];660if (!func)661continue;662663isString = typeof func == "string";664if (isString && self._set_called)665self.called = func;666667cur = (isString ? self[func] : func).apply(self, cur || []);668if (f < length - 1)669cur = !isArray(cur) || cur._use_call ? [cur] : cur670}671return cur;672}673},674/**675* @function getObject676* Gets an object from a String.677* If the object or namespaces the string represent do not678* exist it will create them.679* @codestart680* Foo = {Bar: {Zar: {"Ted"}}}681* $.Class.getobject("Foo.Bar.Zar") //-> "Ted"682* @codeend683* @param {String} objectName the object you want to get684* @param {Object} [current=window] the object you want to look in.685* @return {Object} the object you are looking for.686*/687getObject: $.String.getObject,688/**689* @function newInstance690* Creates a new instance of the class. This method is useful for creating new instances691* with arbitrary parameters.692* <h3>Example</h3>693* @codestart694* $.Class.extend("MyClass",{},{})695* var mc = MyClass.newInstance.apply(null, new Array(parseInt(Math.random()*10,10))696* @codeend697* @return {class} instance of the class698*/699newInstance: function ()700{701var inst = this.rawInstance();702var args;703704if (inst.setup)705args = inst.setup.apply(inst, arguments);706707// Added by [email protected] -- fix for deep cloning of properties708for (var prop in inst.__proto__)709inst[prop] = cloneObject(inst[prop]);710711if (inst.init)712inst.init.apply(inst, isArray(args) ? args : arguments);713714return inst;715},716/**717* Setup gets called on the inherting class with the base class followed by the718* inheriting class's raw properties.719*720* Setup will deeply extend a static defaults property on the base class with721* properties on the base class. For example:722*723* $.Class("MyBase",{724* defaults : {725* foo: 'bar'726* }727* },{})728*729* MyBase("Inheriting",{730* defaults : {731* newProp : 'newVal'732* }733* },{}734*735* Inheriting.defaults -> {foo: 'bar', 'newProp': 'newVal'}736*737* @param {Object} baseClass the base class that is being inherited from738* @param {String} fullName the name of the new class739* @param {Object} staticProps the static properties of the new class740* @param {Object} protoProps the prototype properties of the new class741*/742setup: function (baseClass, fullName)743{744this.defaults = extend(true, {}, baseClass.defaults, this.defaults);745if (this._types == undefined) this._types = [];746this._types.push(this.fullName);747if (this._fullTypeName == undefined) this._fullTypeName = '|';748this._fullTypeName += this.fullName + '|';749return arguments;750},751rawInstance: function ()752{753initializing = true;754var inst = new this();755initializing = false;756return inst;757},758/**759* Extends a class with new static and prototype functions. There are a variety of ways760* to use extend:761* @codestart762* //with className, static and prototype functions763* $.Class.extend('Task',{ STATIC },{ PROTOTYPE })764* //with just classname and prototype functions765* $.Class.extend('Task',{ PROTOTYPE })766* //With just a className767* $.Class.extend('Task')768* @codeend769* @param {String} [fullName] the classes name (used for classes w/ introspection)770* @param {Object} [klass] the new classes static/class functions771* @param {Object} [proto] the new classes prototype functions772* @return {jQuery.Class} returns the new class773*/774extend: function (fullName, klass, proto)775{776// figure out what was passed777if (typeof fullName != 'string')778{779proto = klass;780klass = fullName;781fullName = null;782}783if (!proto)784{785proto = klass;786klass = null;787}788789proto = proto || {};790var _super_class = this,791_super = this.prototype,792name, shortName, namespace, prototype;793794// append the isA function795this.isA = function(typeName)796{797return this._fullTypeName.indexOf('|'+typeName+'|') != -1;798};799800// Instantiate a base class (but only create the instance,801// don't run the init constructor)802initializing = true;803prototype = new this();804initializing = false;805// Copy the properties over onto the new prototype806inheritProps(proto, _super, prototype);807808// The dummy class constructor809810function Class()811{812// All construction is actually done in the init method813if (initializing) return;814815if (this.constructor !== Class && arguments.length)816{ //we are being called w/o new817return arguments.callee.extend.apply(arguments.callee, arguments)818} else819{ //we are being called w/ new820// copy objects821822return this.Class.newInstance.apply(this.Class, arguments)823}824}825826// Copy old stuff onto class827for (name in this)828if (this.hasOwnProperty(name))829Class[name] = cloneObject(this[name]);830831// copy new props on class832inheritProps(klass, this, Class);833834// do namespace stuff835if (fullName)836{837var parts = fullName.split(/\./);838var shortName = parts.pop();839840// Martin Wells (playcraft): bug fix. Don't add a namespace object if the class name841// has no namespace elements (i.e. it's just "MyClass", not "MyProject.MyClass")842if (parts.length > 0)843{844current = clss.getObject(parts.join('.'), window, true),845namespace = current;846}847848current[shortName] = Class;849}850851// set things that can't be overwritten852extend(Class, {853prototype: prototype,854namespace: namespace,855shortName: shortName,856constructor: Class,857fullName: fullName858});859860//make sure our prototype looks nice861Class.prototype.Class = Class.prototype.constructor = Class;862863864/**865* @attribute fullName866* The full name of the class, including namespace, provided for introspection purposes.867* @codestart868* $.Class.extend("MyOrg.MyClass",{},{})869* MyOrg.MyClass.shortName //-> 'MyClass'870* MyOrg.MyClass.fullName //-> 'MyOrg.MyClass'871* @codeend872*/873874var args = Class.setup.apply(Class, concatArgs([_super_class], arguments));875876if (Class.init)877{878Class.init.apply(Class, args || []);879}880881/* @Prototype*/882883return Class;884/**885* @function setup886* If a setup method is provided, it is called when a new887* instances is created. It gets passed the same arguments that888* were given to the Class constructor function (<code> new Class( arguments ... )</code>).889*890* $.Class("MyClass",891* {892* setup: function( val ) {893* this.val = val;894* }895* })896* var mc = new MyClass("Check Check")897* mc.val //-> 'Check Check'898*899* Setup is called before [jQuery.Class.prototype.init init]. If setup900* return an array, those arguments will be used for init.901*902* $.Class("jQuery.Controller",{903* setup : function(htmlElement, rawOptions){904* return [$(htmlElement),905* $.extend({}, this.Class.defaults, rawOptions )]906* }907* })908*909* <div class='whisper'>PRO TIP:910* Setup functions are used to normalize constructor arguments and provide a place for911* setup code that extending classes don't have to remember to call _super to912* run.913* </div>914*915* Setup is not defined on $.Class itself, so calling super in inherting classes916* will break. Don't do the following:917*918* $.Class("Thing",{919* setup : function(){920* this._super(); // breaks!921* }922* })923*924* @return {Array|undefined} If an array is return, [jQuery.Class.prototype.init] is925* called with those arguments; otherwise, the original arguments are used.926*/927//break up928/**929* @function init930* If an <code>init</code> method is provided, it gets called when a new instance931* is created. Init gets called after [jQuery.Class.prototype.setup setup], typically with the932* same arguments passed to the Class933* constructor: (<code> new Class( arguments ... )</code>).934*935* $.Class("MyClass",936* {937* init: function( val ) {938* this.val = val;939* }940* })941* var mc = new MyClass(1)942* mc.val //-> 1943*944* [jQuery.Class.prototype.setup Setup] is able to modify the arguments passed to init. Read945* about it there.946*947*/948//Breaks up code949/**950* @attribute Class951* References the static properties of the instance's class.952* <h3>Quick Example</h3>953* @codestart954* // a class with a static classProperty property955* $.Class.extend("MyClass", {classProperty : true}, {});956*957* // a new instance of myClass958* var mc1 = new MyClass();959*960* //961* mc1.Class.classProperty = false;962*963* // creates a new MyClass964* var mc2 = new mc.Class();965* @codeend966* Getting static properties via the Class property, such as it's967* [jQuery.Class.static.fullName fullName] is very common.968*/969}970971})972973974clss.prototype.975/**976* @function callback977* Returns a callback function. This does the same thing as and is described better in [jQuery.Class.static.callback].978* The only difference is this callback works979* on a instance instead of a class.980* @param {String|Array} fname If a string, it represents the function to be called.981* If it is an array, it will call each function in order and pass the return value of the prior function to the982* next function.983* @return {Function} the callback function984*/985callback = clss.callback;986987988})(jQuery);989990