From: Alexander Ebert Date: Wed, 26 Jun 2013 17:29:46 +0000 (+0200) Subject: Added ability to invoke a callback on worker completion X-Git-Tag: 2.0.0_Beta_5~122 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0cb0c522aba9d69040647f6ba6927f452b37d3bd;p=GitHub%2FWoltLab%2FWCF.git Added ability to invoke a callback on worker completion --- diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index ed2a30cf64..42c8cb9ac3 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -1682,9 +1682,17 @@ WCF.ACP.Options.Group = Class.extend({ * * @param string dialogID * @param string className - * @param object options + * @param string title + * @param object parameters + * @param object callback */ WCF.ACP.Worker = Class.extend({ + /** + * callback invoked after worker completed + * @var object + */ + _callback: null, + /** * dialog id * @var string @@ -1716,8 +1724,10 @@ WCF.ACP.Worker = Class.extend({ * @param string className * @param string title * @param object parameters + * @param object callback */ - init: function(dialogID, className, title, parameters) { + init: function(dialogID, className, title, parameters, callback) { + this._callback = callback || null; this._dialogID = dialogID + 'Worker'; this._dialog = null; this._proxy = new WCF.Action.Proxy({ @@ -1767,6 +1777,9 @@ WCF.ACP.Worker = Class.extend({ }); this._proxy.sendRequest(); } + else if (this._callback !== null) { + this._callback(this, data); + } else { // display continue button var $formSubmit = $('
').appendTo(this._dialog);