Merge pull request #4 from JsSucks/global

Global
This commit is contained in:
Alexei Stukov 2018-01-16 07:02:01 +02:00 committed by GitHub
commit 02df356931
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 796 additions and 682 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,12 +10,11 @@
'use strict';
const { Logger, Utils, PluginManager, BDIpc, WebpackModules, SocketProxy, Global } = require('./modules');
const { Global, Logger, Utils, PluginManager, BDIpc, WebpackModules, SocketProxy } = require('./modules');
class BetterDiscord {
constructor() {
Global.first();
window.bdUtils = Utils;
window.wpm = WebpackModules;
}

View File

@ -10,9 +10,15 @@
const { Module } = require('./modulebase');
const { Events } = require('./events');
const { BDIpc } = require('./bdipc');
class Global extends Module {
constructor(args) {
super(args);
this.first();
}
bindings() {
this.first = this.first.bind(this);
this.setWS = this.setWS.bind(this);
@ -20,6 +26,11 @@ class Global extends Module {
}
first() {
(async () => {
const config = await BDIpc.send('getConfig');
this.setState(config);
})();
if (window.__bd) {
this.setState(window.__bd);
window.__bd = {

View File

@ -1,8 +1,8 @@
export { Global } from './global';
export { Logger, Utils, FileUtils } from './utils';
export { PluginManager } from './pluginmanager';
export { Pluging } from './plugin';
export { BDIpc } from './bdipc';
export { WebpackModules } from './webpackmodules';
export { Global } from './global';
export { Events } from './events';
export { SocketProxy } from './discordsocket';

View File

@ -31,9 +31,9 @@ const Common = {};
const dummyArgs = {
'version': '0.3.1',
'paths': [
{ 'base': 'basePath' },
{ 'plugins': __pluginPath },
{ 'themes': __themePath }
{ 'id': 'base', 'path': 'basePath' },
{ 'id': 'plugins', 'path': __pluginPath },
{ 'id': 'themes', 'path': __themePath }
]
};