Skip to content

Commit

Permalink
Wait addons to boot
Browse files Browse the repository at this point in the history
  • Loading branch information
javalikescript committed Jan 26, 2025
1 parent c76c493 commit c944ed0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 0 additions & 1 deletion extensions/web-base/www/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ var app = new Vue({
case 'addon-change':
if (this.reloadTimeoutId) {
clearTimeout(this.reloadTimeoutId);
this.reloadTimeoutId = undefined;
}
this.reloadTimeoutId = setTimeout(function () {
toaster.toast('Reloading...');
Expand Down
21 changes: 14 additions & 7 deletions extensions/web-base/www/app/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,29 @@ Promise.all([
fetch('addon/').then(rejectIfNotOk).then(getJson),
fetch('/engine/user').then(rejectIfNotOk).then(getJson),
]).then(apply(this, function(webBaseConfig, addons, user) {
var theme = webBaseConfig.theme || 'default'
if (webBaseConfig.title) {
document.title = webBaseConfig.title;
homePage.title = webBaseConfig.title;
}
app.setTheme(webBaseConfig.theme || 'default');
app.user = user;
onHashchange();
setupWebSocket();
if (Array.isArray(addons)) {
return Promise.all(addons.map(function(addon) {
console.log('loading addon ' + addon.id);
return new Promise(function(resolve) {
require(['addon/' + addon.id + '/' + addon.script], resolve);
})
}));
});
})).then(function() {
console.info('addons loaded');
}, function() {
console.info('fail to load addons');
}).then(function() {
return theme;
});
}
})).then(function() {
console.info('addons loaded');
return theme;
})).then(function(theme) {
app.setTheme(theme);
onHashchange();
setupWebSocket();
});

0 comments on commit c944ed0

Please sign in to comment.