Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / lang / aspect / memoizer.js @ 12

History | View | Annotate | Download (1.16 KB)

1 9 andrej.cim
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6
7
8
if(!dojo._hasResource["dojox.lang.aspect.memoizer"]){
9
dojo._hasResource["dojox.lang.aspect.memoizer"]=true;
10
dojo.provide("dojox.lang.aspect.memoizer");
11
(function(){
12
var _1=dojox.lang.aspect;
13
var _2={around:function(_3){
14
var _4=_1.getContext(),_5=_4.joinPoint,_6=_4.instance,t,u,_7;
15
if((t=_6.__memoizerCache)&&(t=t[_5.targetName])&&(_3 in t)){
16
return t[_3];
17
}
18
var _7=_1.proceed.apply(null,arguments);
19
if(!(t=_6.__memoizerCache)){
20
t=_6.__memoizerCache={};
21
}
22
if(!(u=t[_5.targetName])){
23
u=t[_5.targetName]={};
24
}
25
return u[_3]=_7;
26
}};
27
var _8=function(_9){
28
return {around:function(){
29
var _a=_1.getContext(),_b=_a.joinPoint,_c=_a.instance,t,u,_d,_e=_9.apply(_c,arguments);
30
if((t=_c.__memoizerCache)&&(t=t[_b.targetName])&&(_e in t)){
31
return t[_e];
32
}
33
var _d=_1.proceed.apply(null,arguments);
34
if(!(t=_c.__memoizerCache)){
35
t=_c.__memoizerCache={};
36
}
37
if(!(u=t[_b.targetName])){
38
u=t[_b.targetName]={};
39
}
40
return u[_e]=_d;
41
}};
42
};
43
_1.memoizer=function(_f){
44
return arguments.length==0?_2:_8(_f);
45
};
46
})();
47
}