counter.js 615 B

123456789101112131415161718192021222324252627282930
  1. // wrapped by build app
  2. define("dojox/lang/aspect/counter", ["dijit","dojo","dojox"], function(dijit,dojo,dojox){
  3. dojo.provide("dojox.lang.aspect.counter");
  4. (function(){
  5. var aop = dojox.lang.aspect;
  6. var Counter = function(){
  7. this.reset();
  8. };
  9. dojo.extend(Counter, {
  10. before: function(/*arguments*/){
  11. ++this.calls;
  12. },
  13. afterThrowing: function(/*excp*/){
  14. ++this.errors;
  15. },
  16. reset: function(){
  17. this.calls = this.errors = 0;
  18. }
  19. });
  20. aop.counter = function(){
  21. // summary:
  22. // Returns an object, which can be used to count calls to methods.
  23. return new Counter; // Object
  24. };
  25. })();
  26. });