1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- if(!dojo._hasResource["dojox.timing._base"]){
- dojo._hasResource["dojox.timing._base"] = true;
- dojo.provide("dojox.timing._base");
- dojo.experimental("dojox.timing");
- dojox.timing.Timer = function(/*int*/ interval){
-
-
-
- this.timer = null;
- this.isRunning = false;
- this.interval = interval;
- this.onStart = null;
- this.onStop = null;
- };
- dojo.extend(dojox.timing.Timer, {
- onTick : function(){
-
- },
-
- setInterval : function(interval){
-
-
- if (this.isRunning){
- window.clearInterval(this.timer);
- }
- this.interval = interval;
- if (this.isRunning){
- this.timer = window.setInterval(dojo.hitch(this, "onTick"), this.interval);
- }
- },
-
- start : function(){
-
-
-
-
- if (typeof this.onStart == "function"){
- this.onStart();
- }
- this.isRunning = true;
- this.timer = window.setInterval(dojo.hitch(this, "onTick"), this.interval);
- },
-
- stop : function(){
-
-
- if (typeof this.onStop == "function"){
- this.onStop();
- }
- this.isRunning = false;
- window.clearInterval(this.timer);
- }
- });
- }
|