]> git.wh0rd.org - tt-rss.git/blobdiff - lib/dojo/AdapterRegistry.js
lib: Upgrade Dojo and Dijit from 1.8.3 to 1.12.1
[tt-rss.git] / lib / dojo / AdapterRegistry.js
index 1d688a3b10ad4a35becefdc2d3a5a5d1c048358d..c27f951aee45fda00ca0b9c8ccdcdf1741b0fd47 100644 (file)
@@ -1,107 +1,8 @@
 /*
-       Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+       Copyright (c) 2004-2016, The JS Foundation All Rights Reserved.
        Available via Academic Free License >= 2.1 OR the modified BSD license.
        see: http://dojotoolkit.org/license for details
 */
 
-
-if(!dojo._hasResource["dojo.AdapterRegistry"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.AdapterRegistry"] = true;
-dojo.provide("dojo.AdapterRegistry");
-
-
-dojo.AdapterRegistry = function(/*Boolean?*/ returnWrappers){
-       //      summary:
-       //              A registry to make contextual calling/searching easier.
-       //      description:
-       //              Objects of this class keep list of arrays in the form [name, check,
-       //              wrap, directReturn] that are used to determine what the contextual
-       //              result of a set of checked arguments is. All check/wrap functions
-       //              in this registry should be of the same arity.
-       //      example:
-       //      |       // create a new registry
-       //      |       var reg = new dojo.AdapterRegistry();
-       //      |       reg.register("handleString",
-       //      |               dojo.isString,
-       //      |               function(str){
-       //      |                       // do something with the string here
-       //      |               }
-       //      |       );
-       //      |       reg.register("handleArr",
-       //      |               dojo.isArray,
-       //      |               function(arr){
-       //      |                       // do something with the array here
-       //      |               }
-       //      |       );
-       //      |
-       //      |       // now we can pass reg.match() *either* an array or a string and
-       //      |       // the value we pass will get handled by the right function
-       //      |       reg.match("someValue"); // will call the first function
-       //      |       reg.match(["someValue"]); // will call the second
-
-       this.pairs = [];
-       this.returnWrappers = returnWrappers || false; // Boolean
-};
-
-dojo.extend(dojo.AdapterRegistry, {
-       register: function(/*String*/ name, /*Function*/ check, /*Function*/ wrap, /*Boolean?*/ directReturn, /*Boolean?*/ override){
-               //      summary:
-               //              register a check function to determine if the wrap function or
-               //              object gets selected
-               //      name:
-               //              a way to identify this matcher.
-               //      check:
-               //              a function that arguments are passed to from the adapter's
-               //              match() function.  The check function should return true if the
-               //              given arguments are appropriate for the wrap function.
-               //      directReturn:
-               //              If directReturn is true, the value passed in for wrap will be
-               //              returned instead of being called. Alternately, the
-               //              AdapterRegistry can be set globally to "return not call" using
-               //              the returnWrappers property. Either way, this behavior allows
-               //              the registry to act as a "search" function instead of a
-               //              function interception library.
-               //      override:
-               //              If override is given and true, the check function will be given
-               //              highest priority. Otherwise, it will be the lowest priority
-               //              adapter.
-               this.pairs[((override) ? "unshift" : "push")]([name, check, wrap, directReturn]);
-       },
-
-       match: function(/* ... */){
-               // summary:
-               //              Find an adapter for the given arguments. If no suitable adapter
-               //              is found, throws an exception. match() accepts any number of
-               //              arguments, all of which are passed to all matching functions
-               //              from the registered pairs.
-               for(var i = 0; i < this.pairs.length; i++){
-                       var pair = this.pairs[i];
-                       if(pair[1].apply(this, arguments)){
-                               if((pair[3])||(this.returnWrappers)){
-                                       return pair[2];
-                               }else{
-                                       return pair[2].apply(this, arguments);
-                               }
-                       }
-               }
-               throw new Error("No match found");
-       },
-
-       unregister: function(name){
-               // summary: Remove a named adapter from the registry
-
-               // FIXME: this is kind of a dumb way to handle this. On a large
-               // registry this will be slow-ish and we can use the name as a lookup
-               // should we choose to trade memory for speed.
-               for(var i = 0; i < this.pairs.length; i++){
-                       var pair = this.pairs[i];
-                       if(pair[0] == name){
-                               this.pairs.splice(i, 1);
-                               return true;
-                       }
-               }
-               return false;
-       }
-});
-
-}
+//>>built
+define("dojo/AdapterRegistry",["./_base/kernel","./_base/lang"],function(_1,_2){var _3=_1.AdapterRegistry=function(_4){this.pairs=[];this.returnWrappers=_4||false;};_2.extend(_3,{register:function(_5,_6,_7,_8,_9){this.pairs[((_9)?"unshift":"push")]([_5,_6,_7,_8]);},match:function(){for(var i=0;i<this.pairs.length;i++){var _a=this.pairs[i];if(_a[1].apply(this,arguments)){if((_a[3])||(this.returnWrappers)){return _a[2];}else{return _a[2].apply(this,arguments);}}}throw new Error("No match found");},unregister:function(_b){for(var i=0;i<this.pairs.length;i++){var _c=this.pairs[i];if(_c[0]==_b){this.pairs.splice(i,1);return true;}}return false;}});return _3;});
\ No newline at end of file