Some improvements to WCF.PeriodicalExecuter
authorAlexander Ebert <ebert@woltlab.com>
Fri, 24 Apr 2015 14:28:43 +0000 (16:28 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 24 Apr 2015 14:28:43 +0000 (16:28 +0200)
wcfsetup/install/files/js/WCF.js

index 26587cd3fcdc6e6aaae19a8718d8d2d6ef411cd4..31486786d77a461e5c553092a56adc7a1fe3e29a 100755 (executable)
@@ -2410,13 +2410,33 @@ WCF.PeriodicalExecuter = Class.extend({
        
        /**
         * Resumes the interval-based callback execution.
+        * 
+        * @deprecated  2.1 - use restart() instead
         */
        resume: function() {
+               this.restart();
+       },
+       
+       /**
+        * Restarts the interval-based callback execution.
+        */
+       restart: function() {
                if (this._intervalID) {
                        this.stop();
                }
                
                this._intervalID = setInterval($.proxy(this._execute, this), this._interval);
+       },
+       
+       /**
+        * Sets the interval and restarts the interval.
+        * 
+        * @param       integer         interval
+        */
+       setInterval: function(interval) {
+               this._interval = interval;
+               
+               this.restart();
        }
 });