mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
improve egw.langRequire to return a Promise, if no callback specified
This commit is contained in:
parent
d185a53f8e
commit
eefd8ed972
@ -133,6 +133,7 @@ egw.extend('lang', egw.MODULE_GLOBAL, function()
|
||||
* }
|
||||
* @param {function} _callback called after loading, if not given ready event will be postponed instead
|
||||
* @param {object} _context for callback
|
||||
* @return Promise if no _callback specified
|
||||
*/
|
||||
langRequire: function(_window, _apps, _callback, _context) {
|
||||
// Get the ready and the files module for the given window
|
||||
@ -171,10 +172,14 @@ egw.extend('lang', egw.MODULE_GLOBAL, function()
|
||||
// Require a "ready postpone token"
|
||||
var token = ready.readyWaitFor();
|
||||
|
||||
// Call "readyDone" once all js files have been included.
|
||||
files.includeJS(jss, function () {
|
||||
ready.readyDone(token);
|
||||
}, this);
|
||||
return new Promise(function(resolve)
|
||||
{
|
||||
// Call "readyDone" once all js files have been included.
|
||||
files.includeJS(jss, function () {
|
||||
ready.readyDone(token);
|
||||
resolve();
|
||||
}, this);
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (typeof _callback == 'function')
|
||||
|
Loading…
Reference in New Issue
Block a user