root / trunk / web / dojo / dojox / lang / aspect / counter.js
History | View | Annotate | Download (613 Bytes)
| 1 |
/*
|
|---|---|
| 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.counter"]){ |
| 9 |
dojo._hasResource["dojox.lang.aspect.counter"]=true; |
| 10 |
dojo.provide("dojox.lang.aspect.counter");
|
| 11 |
(function(){
|
| 12 |
var _1=dojox.lang.aspect;
|
| 13 |
var _2=function(){ |
| 14 |
this.reset();
|
| 15 |
}; |
| 16 |
dojo.extend(_2,{before:function(){
|
| 17 |
++this.calls;
|
| 18 |
},afterThrowing:function(){ |
| 19 |
++this.errors;
|
| 20 |
},reset:function(){ |
| 21 |
this.calls=this.errors=0; |
| 22 |
}}); |
| 23 |
_1.counter=function(){ |
| 24 |
return new _2; |
| 25 |
}; |
| 26 |
})(); |
| 27 |
} |