1///////////////////////////////////////////////////////////////////////////// 2Sys.Timer = function() { 3Sys.Timer.initializeBase(this);this._interval = 1000;this._enabled = false;this._timer = null;} 4Sys.Timer.prototype = { 5get_interval: function() { 6return this._interval;}, 7set_interval: function(value) { 8if (this._interval !== value) { 9this._interval = value;this.raisePropertyChanged('interval');if (!this.get_isUpdating() && (this._timer !== null)) { 10this._stopTimer();this._startTimer();} 11} 12}, 13get_enabled: function() { 14return this._enabled;}, 15set_enabled: function(value) { 16if (value !== this.get_enabled()) { 17this._enabled = value;this.raisePropertyChanged('enabled');if (!this.get_isUpdating()) { 18if (value) { 19this._startTimer();} 20else { 21this._stopTimer();} 22} 23} 24}, 25add_tick: function(handler) { 26this.get_events().addHandler("tick", handler);}, 27remove_tick: function(handler) { 28this.get_events().removeHandler("tick", handler);}, 29dispose: function() { 30this.set_enabled(false);this._stopTimer();Sys.Timer.callBaseMethod(this, 'dispose');}, 31updated: function() { 32Sys.Timer.callBaseMethod(this, 'updated');if (this._enabled) { 33this._stopTimer();this._startTimer();} 34}, 35_timerCallback: function() { 36var handler = this.get_events().getHandler("tick");if (handler) { 37handler(this, Sys.EventArgs.Empty);} 38}, 39_startTimer: function() { 40this._timer = window.setInterval(Function.createDelegate(this, this._timerCallback), this._interval);}, 41_stopTimer: function() { 42window.clearInterval(this._timer);this._timer = null;} 43} 44Sys.Timer.descriptor = { 45properties: [ {name: 'interval', type: Number}, 46{name: 'enabled', type: Boolean} ], 47events: [ {name: 'tick'} ] 48} 49Sys.Timer.registerClass('Sys.Timer', Sys.Component);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.