BetterDiscordApp-v2/client/src/index.js

54 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-01-10 21:48:10 +01:00
/**
* BetterDiscord Client Core
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
* All rights reserved.
* https://github.com/JsSucks - https://betterdiscord.net
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
2018-01-10 21:48:10 +01:00
*/
'use strict';
2018-01-19 06:17:07 +01:00
const styles = require('./styles/index.scss');
const { Global, Logger, Utils, PluginManager, BDIpc, WebpackModules, SocketProxy, Events, Vendor } = require('./modules');
2018-01-19 02:37:21 +01:00
//const { UI } = require('./modules/ui/index.jsx');
2018-01-11 00:46:05 +01:00
2018-01-10 21:48:10 +01:00
class BetterDiscord {
constructor() {
2018-01-15 06:09:28 +01:00
window.bdUtils = Utils;
2018-01-15 12:59:45 +01:00
window.wpm = WebpackModules;
2018-01-19 02:37:21 +01:00
Events.on('global-ready', e => {
2018-01-19 03:10:10 +01:00
const { UI } = require('./modules/ui/vueui.js');
2018-01-19 02:37:21 +01:00
this.ui = new UI();
2018-01-25 12:03:12 +01:00
this.init();
2018-01-19 02:37:21 +01:00
});
2018-01-19 06:17:07 +01:00
//Inject styles to head for now
const style = document.createElement('style');
style.id = 'bd-main';
style.type = 'text/css';
style.appendChild(document.createTextNode(styles));
document.head.appendChild(style);
2018-01-25 12:03:12 +01:00
this.init();
}
async init() {
try {
await PluginManager.loadAllPlugins();
} catch (err) {
}
Events.emit('ready');
2018-01-10 21:48:10 +01:00
}
}
2018-01-11 00:07:35 +01:00
if (window.BetterDiscord) {
2018-01-11 07:02:11 +01:00
Logger.log('main', 'Attempting to inject again?');
2018-01-11 00:07:35 +01:00
} else {
let bdInstance = new BetterDiscord();
window.BetterDiscord = {'vendor': Vendor};
2018-01-11 00:07:35 +01:00
}