Module resolves and base pluginmanager
This commit is contained in:
parent
6385c15236
commit
85db5af655
|
@ -8,9 +8,9 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { DOM, BdUI } from './ui';
|
import { DOM, BdUI } from 'ui';
|
||||||
import BdCss from './styles/index.scss';
|
import BdCss from './styles/index.scss';
|
||||||
import { Events, CssEditor } from './modules';
|
import { Events, CssEditor, Globals } from 'modules';
|
||||||
|
|
||||||
class BetterDiscord {
|
class BetterDiscord {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ClientIPC } from '../../../common/modules';
|
import { ClientIPC } from 'common';
|
||||||
import { DOM } from '../ui';
|
import { DOM } from 'ui';
|
||||||
|
|
||||||
export default class {
|
export default class {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/**
|
||||||
|
* BetterDiscord Globals Module
|
||||||
|
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
||||||
|
* All rights reserved.
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Module from './module';
|
||||||
|
import Events from './events';
|
||||||
|
import { ClientIPC } from 'bdipc';
|
||||||
|
|
||||||
|
export default new class extends Module {
|
||||||
|
|
||||||
|
constructor(args) {
|
||||||
|
super(args);
|
||||||
|
this.first();
|
||||||
|
}
|
||||||
|
|
||||||
|
bindings() {
|
||||||
|
this.first = this.first.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
first() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,3 +0,0 @@
|
||||||
export { default as Events } from './events';
|
|
||||||
export { default as Settings } from './settings';
|
|
||||||
export { default as CssEditor } from './csseditor';
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/**
|
||||||
|
* BetterDiscord Module Base
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Base Module that every non-static module should extend
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default class Module {
|
||||||
|
|
||||||
|
constructor(args) {
|
||||||
|
this.__ = {
|
||||||
|
state: args || {},
|
||||||
|
args
|
||||||
|
}
|
||||||
|
this.setState = this.setState.bind(this);
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
if (this.bindings) this.bindings();
|
||||||
|
if (this.setInitialState) this.setInitialState(this.state);
|
||||||
|
if (this.events) this.events();
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(newState) {
|
||||||
|
const oldState = this.state;
|
||||||
|
Object.assign(this.state, newState);
|
||||||
|
if (this.stateChanged) this.stateChanged(oldState, newState);
|
||||||
|
}
|
||||||
|
|
||||||
|
set args(t) { }
|
||||||
|
get args() { return this.__.args; }
|
||||||
|
|
||||||
|
|
||||||
|
set state(state) { return this.__.state = state; }
|
||||||
|
get state() { return this.__.state; }
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
export { default as Events } from './events';
|
||||||
|
export { default as Settings } from './settings';
|
||||||
|
export { default as CssEditor } from './csseditor';
|
||||||
|
export { default as PluginManager } from './pluginmanager';
|
||||||
|
export { default as Globals } from './globals';
|
|
@ -0,0 +1,21 @@
|
||||||
|
/**
|
||||||
|
* BetterDiscord Plugin Manager Module
|
||||||
|
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
||||||
|
* All rights reserved.
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Globals from './globals';
|
||||||
|
|
||||||
|
const localPlugins = [];
|
||||||
|
|
||||||
|
export default class {
|
||||||
|
|
||||||
|
static get localPlugins() {
|
||||||
|
return localPlugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -43,7 +43,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// Imports
|
// Imports
|
||||||
import { Settings } from '../../modules';
|
import { Settings } from 'modules';
|
||||||
import { SidebarView, Sidebar, SidebarItem, ContentColumn } from './sidebar';
|
import { SidebarView, Sidebar, SidebarItem, ContentColumn } from './sidebar';
|
||||||
import { CoreSettings, UISettings, EmoteSettings, CssEditorView } from './bd';
|
import { CoreSettings, UISettings, EmoteSettings, CssEditorView } from './bd';
|
||||||
import { SvgX } from './common';
|
import { SvgX } from './common';
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// Imports
|
// Imports
|
||||||
import { Events } from '../../modules';
|
import { Events } from 'modules';
|
||||||
import BdSettings from './BdSettings.vue';
|
import BdSettings from './BdSettings.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Imports
|
// Imports
|
||||||
import { CssEditor } from '../../../modules';
|
import { CssEditor } from 'modules';
|
||||||
import { SettingsWrapper } from './';
|
import { SettingsWrapper } from './';
|
||||||
import { SettingSwitch, FormButton } from '../common';
|
import { SettingSwitch, FormButton } from '../common';
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,13 @@ module.exports = {
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
vue$: path.resolve('..', 'node_modules', 'vue', 'dist', 'vue.esm.js')
|
vue$: path.resolve('..', 'node_modules', 'vue', 'dist', 'vue.esm.js')
|
||||||
}
|
},
|
||||||
|
modules: [
|
||||||
|
path.resolve('..', 'node_modules'),
|
||||||
|
path.resolve('..', 'common', 'modules'),
|
||||||
|
path.resolve('src', 'modules'),
|
||||||
|
path.resolve('src', 'ui')
|
||||||
|
]
|
||||||
}
|
}
|
||||||
/* resolve: {
|
/* resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
|
|
Loading…
Reference in New Issue