// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.

Type.registerNamespace("Telerik.Web");
Telerik.Web.Timer=function(){
Telerik.Web.Timer.initializeBase(this);
this._interval=1000;
this._enabled=false;
this._timer=null;
};
Telerik.Web.Timer.prototype={get_interval:function(){
return this._interval;
},set_interval:function(_1){
if(this._interval!==_1){
this._interval=_1;
this.raisePropertyChanged("interval");
if(!this.get_isUpdating()&&(this._timer!==null)){
this._stopTimer();
this._startTimer();
}
}
},get_enabled:function(){
return this._enabled;
},set_enabled:function(_2){
if(_2!==this.get_enabled()){
this._enabled=_2;
this.raisePropertyChanged("enabled");
if(!this.get_isUpdating()){
if(_2){
this._startTimer();
}else{
this._stopTimer();
}
}
}
},add_tick:function(_3){
this.get_events().addHandler("tick",_3);
},remove_tick:function(_4){
this.get_events().removeHandler("tick",_4);
},dispose:function(){
this.set_enabled(false);
this._stopTimer();
Telerik.Web.Timer.callBaseMethod(this,"dispose");
},updated:function(){
Telerik.Web.Timer.callBaseMethod(this,"updated");
if(this._enabled){
this._stopTimer();
this._startTimer();
}
},_timerCallback:function(){
var _5=this.get_events().getHandler("tick");
if(_5){
_5(this,Sys.EventArgs.Empty);
}
},_startTimer:function(){
this._timer=window.setInterval(Function.createDelegate(this,this._timerCallback),this._interval);
},_stopTimer:function(){
window.clearInterval(this._timer);
this._timer=null;
}};
Telerik.Web.Timer.descriptor={properties:[{name:"interval",type:Number},{name:"enabled",type:Boolean}],events:[{name:"tick"}]};
Telerik.Web.Timer.registerClass("Telerik.Web.Timer",Sys.Component);


if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();