Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / timing / _base.js @ 10

History | View | Annotate | Download (1.02 KB)

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.timing._base"]){
9
dojo._hasResource["dojox.timing._base"]=true;
10
dojo.provide("dojox.timing._base");
11
dojo.experimental("dojox.timing");
12
dojox.timing.Timer=function(_1){
13
this.timer=null;
14
this.isRunning=false;
15
this.interval=_1;
16
this.onStart=null;
17
this.onStop=null;
18
};
19
dojo.extend(dojox.timing.Timer,{onTick:function(){
20
},setInterval:function(_2){
21
if(this.isRunning){
22
window.clearInterval(this.timer);
23
}
24
this.interval=_2;
25
if(this.isRunning){
26
this.timer=window.setInterval(dojo.hitch(this,"onTick"),this.interval);
27
}
28
},start:function(){
29
if(typeof this.onStart=="function"){
30
this.onStart();
31
}
32
this.isRunning=true;
33
this.timer=window.setInterval(dojo.hitch(this,"onTick"),this.interval);
34
},stop:function(){
35
if(typeof this.onStop=="function"){
36
this.onStop();
37
}
38
this.isRunning=false;
39
window.clearInterval(this.timer);
40
}});
41
}