From 032b6044c58cdcd2336987cd327f419d2dbb4cdf Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 24 Apr 2015 16:28:43 +0200 Subject: [PATCH] Some improvements to WCF.PeriodicalExecuter --- wcfsetup/install/files/js/WCF.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 26587cd3fc..31486786d7 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -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(); } }); -- 2.20.1