fix async loading caused app.js not being loaded before et2.load() tried to instantiate it

This commit is contained in:
Ralf Becker
2021-06-08 17:13:30 +02:00
parent 8fa2bb466b
commit bfea641321
7 changed files with 35 additions and 87 deletions

View File

@ -521,17 +521,10 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
// check if we need a not yet included app.js object --> include it now and return a Promise
else if (i == 1 && parts[0] == 'app' && typeof app.classes[parts[1]] === 'undefined')
{
const self = this;
return new Promise(function(resolve, reject)
{
// cache for a day, better then no invalidation
self.includeJS('/'+parts[1]+'/js/app.js?'+((new Date).valueOf()/86400|0).toString(), function ()
{
resolve(self.applyFunc(_func, args, _context));
}, self, self.webserverUrl);
});
this.includeJS('/'+parts[1]+'/js/app.js', undefined, undefined, this.webserverUrl)
.then(() => this.applyFunc(_func, args, _context));
}
// check if we need a not yet instanciated app.js object --> instanciate it now
// check if we need a not yet instantiated app.js object --> instantiate it now
else if (i == 1 && parts[0] == 'app' && typeof app.classes[parts[1]] === 'function')
{
parent = parent[parts[1]] = new app.classes[parts[1]]();