Load external content after builtin modules

This commit is contained in:
Samuel Elliott 2018-08-22 18:37:39 +01:00
parent d02be1521d
commit 73192f5762
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
1 changed files with 35 additions and 31 deletions

View File

@ -73,11 +73,20 @@ class BetterDiscord {
Globals.initg(); Globals.initg();
} }
globalReady() {
BdUI.initUiEvents();
this.vueInstance = BdUI.injectUi();
this.init();
}
async init() { async init() {
try { try {
await Database.init(); await Database.init();
await Settings.loadSettings(); await Settings.loadSettings();
await ModuleManager.initModules(); await ModuleManager.initModules();
BuiltinManager.initAll();
if (tests) this.initTests();
if (!ignoreExternal) { if (!ignoreExternal) {
await ExtModuleManager.loadAllModules(true); await ExtModuleManager.loadAllModules(true);
@ -85,45 +94,40 @@ class BetterDiscord {
await ThemeManager.loadAllThemes(true); await ThemeManager.loadAllThemes(true);
} }
if (!Settings.get('core', 'advanced', 'ignore-content-manager-errors'))
Modals.showContentManagerErrors();
Events.emit('ready'); Events.emit('ready');
Events.emit('discord-ready'); Events.emit('discord-ready');
BuiltinManager.initAll();
function showDummyNotif() { // eslint-disable-line no-inner-declarations if (!Settings.get('core', 'advanced', 'ignore-content-manager-errors'))
Notifications.add('Dummy Notification', [ Modals.showContentManagerErrors();
{
text: 'Show Again', onClick: function () {
setTimeout(showDummyNotif, 5000);
return true;
}
},
{
text: 'Ignore', onClick: function () {
return true;
}
}
]);
}
showDummyNotif();
DiscordContextMenu.add([
{
text: 'Hello',
onClick: () => { Toasts.info('Hello!'); }
}
]);
} catch (err) { } catch (err) {
Logger.err('main', ['FAILED TO LOAD!', err]); Logger.err('main', ['FAILED TO LOAD!', err]);
} }
} }
globalReady() { initTests() {
BdUI.initUiEvents(); function showDummyNotif() { // eslint-disable-line no-inner-declarations
this.vueInstance = BdUI.injectUi(); Notifications.add('Dummy Notification', [
this.init(); {
text: 'Show Again', onClick: function () {
setTimeout(showDummyNotif, 5000);
return true;
}
},
{
text: 'Ignore', onClick: function () {
return true;
}
}
]);
}
showDummyNotif();
DiscordContextMenu.add([
{
text: 'Hello',
onClick: () => { Toasts.info('Hello!'); }
}
]);
} }
} }