summaryrefslogtreecommitdiff
path: root/js/dojo/dojox/lang/aspect/counter.js
blob: cb17981950c41e85636794c24441d83c6e2407c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//>>built
// wrapped by build app
define("dojox/lang/aspect/counter", ["dijit","dojo","dojox"], function(dijit,dojo,dojox){
dojo.provide("dojox.lang.aspect.counter");

(function(){
	var aop = dojox.lang.aspect;
	
	var Counter = function(){
		this.reset();
	};
	dojo.extend(Counter, {
		before: function(/*arguments*/){
			++this.calls;
		},
		afterThrowing: function(/*excp*/){
			++this.errors;
		},
		reset: function(){
			this.calls = this.errors = 0;
		}
	});
	
	aop.counter = function(){
		// summary:
		//		Returns an object, which can be used to count calls to methods.
	
		return new Counter;	// Object
	};
})();
});