From 0cb0c522aba9d69040647f6ba6927f452b37d3bd Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 26 Jun 2013 19:29:46 +0200 Subject: [PATCH] Added ability to invoke a callback on worker completion --- wcfsetup/install/files/acp/js/WCF.ACP.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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); -- 2.20.1