Skip to content

Commit

Permalink
dojox.lang.aspect: cleanup. !strict
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.dojotoolkit.org/src/dojox/trunk@13712 560b804f-0ae3-0310-86f3-f6aa0a117693
  • Loading branch information
uhop committed May 13, 2008
1 parent 30b2905 commit 5eb1c5d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
14 changes: 11 additions & 3 deletions lang/README
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,25 @@ Credits
-------------------------------------------------------------------------------
Project description

Implementation of common functional operations, and provisions
Later we can add other JS language-related helpers.
Implementation of common functional operations, and provisions, aspect-oriented
helpers. Later we can add other JS language-related helpers.
-------------------------------------------------------------------------------
Dependencies:

None.
-------------------------------------------------------------------------------
Documentation

For now:

dojox.lang.functional:
http://lazutkin.com/blog/2008/jan/12/functional-fun-javascript-dojo/

-------------------------------------------------------------------------------
Installation instructions

Grab the following from the Dojo SVN Repository:
http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/lang/*
http://svn.dojotoolkit.org/src/dojo/dojox/trunk/lang/*

Install into the following directory structure:
/dojox/lang/
Expand All @@ -35,3 +40,6 @@ Install into the following directory structure:
Additional Notes

See tests and the source for more details.

LICENSE in this directory contains the MIT license by Oliver Steele for
dojox.lang.functional.lambda, which was derived from his original implementation.
18 changes: 2 additions & 16 deletions lang/aspect/memoizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@ dojo.provide("dojox.lang.aspect.memoizer");
(function(){
var aop = dojox.lang.aspect;

var reset = function(/*String|Array?*/ method){
var that = aop.getContext().instance, t;
if(!(t = that.__memoizerCache)){ return; }
if(arguments.length == 0){
delete that.__memoizerCache;
}else if(dojo.isArray(method)){
dojo.forEach(method, function(m){ delete t[m]; });
}else{
delete t[method];
}
};
var memoize1 = {
around: function(key){
var ctx = aop.getContext(), self = ctx.joinPoint, that = ctx.instance, t, u, ret;
Expand All @@ -24,8 +13,7 @@ dojo.provide("dojox.lang.aspect.memoizer");
if(!(t = that.__memoizerCache)){ t = that.__memoizerCache = {}; }
if(!(u = t[self.targetName])){ u = t[self.targetName] = {}; }
return u[key] = ret;
},
reset: reset
}
};

var memoizeN = function(/*Function*/keyMaker){
Expand All @@ -40,8 +28,7 @@ dojo.provide("dojox.lang.aspect.memoizer");
if(!(t = that.__memoizerCache)){ t = that.__memoizerCache = {}; }
if(!(u = t[self.targetName])){ u = t[self.targetName] = {}; }
return u[key] = ret;
},
reset: reset
}
};
};

Expand All @@ -55,5 +42,4 @@ dojo.provide("dojox.lang.aspect.memoizer");

return arguments.length == 0 ? memoize1 : memoizeN(keyMaker); // Object
};
aop.memoizer._reset = reset;
})();
17 changes: 14 additions & 3 deletions lang/aspect/memoizerGuard.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
dojo.provide("dojox.lang.aspect.memoizerGuard");
dojo.require("dojox.lang.aspect.memoizer");

(function(){
var aop = dojox.lang.aspect, reset = aop.memoizer._reset;
var aop = dojox.lang.aspect,
reset = function(/*String|Array?*/ method){
var that = aop.getContext().instance, t;
if(!(t = that.__memoizerCache)){ return; }
if(arguments.length == 0){
delete that.__memoizerCache;
}else if(dojo.isArray(method)){
dojo.forEach(method, function(m){ delete t[m]; });
}else{
delete t[method];
}
};


aop.memoizerGuard = function(/*String|Array?*/ method){
// summary:
// Invalidates cache (see dojox.lang.aspect.memoizer)
// Invalidates the memoizer's cache (see dojox.lang.aspect.memoizer)
// after calling certain methods.
//
// method:
Expand Down
2 changes: 1 addition & 1 deletion lang/aspect/tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dojo.provide("dojox.lang.aspect.tracer");
}
});

aop.tracer = function(/*Boolean*/ grouping, /*Boolean*/ suppressInstance){
aop.tracer = function(/*Boolean*/ grouping){
// summary:
// Returns an object, which can be used to trace calls with Firebug's console.
// Prints argument, a return value, or an exception.
Expand Down

0 comments on commit 5eb1c5d

Please sign in to comment.