diff options
Diffstat (limited to 'js/dojo-1.6/dojox/lang/functional/util.xd.js')
| -rw-r--r-- | js/dojo-1.6/dojox/lang/functional/util.xd.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/js/dojo-1.6/dojox/lang/functional/util.xd.js b/js/dojo-1.6/dojox/lang/functional/util.xd.js new file mode 100644 index 0000000..7e6e44f --- /dev/null +++ b/js/dojo-1.6/dojox/lang/functional/util.xd.js @@ -0,0 +1,62 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.lang.functional.util"],
+["require", "dojox.lang.functional.lambda"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.lang.functional.util"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.functional.util"] = true;
+dojo.provide("dojox.lang.functional.util");
+
+dojo.require("dojox.lang.functional.lambda");
+
+// This module provides helpers:
+// - inlining string lambda functions.
+
+(function(){
+ var df = dojox.lang.functional;
+
+ dojo.mixin(df, {
+ inlineLambda: function(/*String*/ lambda, /*String|Array*/ init, /*Function?*/ add2dict){
+ // summary:
+ // Creates the inlined version of a string lambda.
+ // lambda:
+ // The String variable representing the lambda function.
+ // init:
+ // Conveys how to initialize parameters. If it is a String, then the apply() method
+ // would be emulated treating "init" as a list of input parameters.
+ // It it is an Array, then the call() method is emulated treating array members
+ // as input parameters.
+ // add2dict:
+ // The optional function, which is used to record names of lambda parameters.
+ // If supplied, this function is called with a name of every parameter.
+
+ var s = df.rawLambda(lambda);
+ if(add2dict){
+ df.forEach(s.args, add2dict);
+ }
+ var ap = typeof init == "string", // apply or call?
+ n = ap ? s.args.length : Math.min(s.args.length, init.length),
+ a = new Array(4 * n + 4), i, j = 1;
+ for(i = 0; i < n; ++i){
+ a[j++] = s.args[i];
+ a[j++] = "=";
+ a[j++] = ap ? init + "[" + i + "]": init[i];
+ a[j++] = ",";
+ }
+ a[0] = "(";
+ a[j++] = "(";
+ a[j++] = s.body;
+ a[j] = "))";
+ return a.join(""); // String
+ }
+ });
+})();
+
+}
+
+}};});
|
