parent
45fb0664df
commit
d54079b005
|
@ -18,6 +18,7 @@ import IPC from "./ipc";
|
|||
import LoadingIcon from "../loadingicon";
|
||||
import Styles from "../styles/index.css";
|
||||
import Editor from "./editor";
|
||||
import {WebpackModules} from "modules";
|
||||
|
||||
export default new class Core {
|
||||
async startup() {
|
||||
|
@ -67,7 +68,7 @@ export default new class Core {
|
|||
for (const module in Builtins) {
|
||||
Builtins[module].initialize();
|
||||
}
|
||||
|
||||
this.polyfillWebpack();
|
||||
Logger.log("Startup", "Loading Plugins");
|
||||
// const pluginErrors = [];
|
||||
const pluginErrors = PluginManager.initialize();
|
||||
|
@ -90,6 +91,17 @@ export default new class Core {
|
|||
}
|
||||
}
|
||||
|
||||
polyfillWebpack() {
|
||||
if (typeof(webpackJsonp) !== "undefined") return;
|
||||
|
||||
window.webpackJsonp = [];
|
||||
window.webpackJsonp.length = 10000; // In case plugins are waiting for that.
|
||||
window.webpackJsonp.flat = () => window.webpackJsonp;
|
||||
window.webpackJsonp.push = ([[], module, [[id]]]) => {
|
||||
return module[id]({}, {}, WebpackModules.require);
|
||||
};
|
||||
}
|
||||
|
||||
waitForGuilds() {
|
||||
// TODO: experiment with waiting for CONNECTION_OPEN event instead
|
||||
const GuildClasses = DiscordModules.GuildClasses;
|
||||
|
|
|
@ -128,6 +128,7 @@ const protect = theModule => {
|
|||
};
|
||||
|
||||
export default class WebpackModules {
|
||||
static get chunkName() {return "webpackChunkdiscord_app";}
|
||||
|
||||
static find(filter, first = true) {return this.getModule(filter, first);}
|
||||
static findAll(filter) {return this.getModule(filter, false);}
|
||||
|
@ -249,9 +250,18 @@ export default class WebpackModules {
|
|||
static get require() {
|
||||
if (this._require) return this._require;
|
||||
const id = "bd-webpackmodules";
|
||||
const __webpack_require__ = window.webpackJsonp.push([[], {
|
||||
[id]: (module, exports, __internal_require__) => module.exports = __internal_require__
|
||||
}, [[id]]]);
|
||||
let __webpack_require__ = undefined;
|
||||
if (typeof (webpackJsonp) !== "undefined") {
|
||||
__webpack_require__ = window.webpackJsonp.push([[], {
|
||||
[id]: (module, exports, __internal_require__) => module.exports = __internal_require__
|
||||
}, [[id]]]);
|
||||
} else if (typeof (window[this.chunkName]) !== "undefined") {
|
||||
window[this.chunkName].push([[id],
|
||||
{},
|
||||
__internal_require__ => __webpack_require__ = __internal_require__
|
||||
]);
|
||||
}
|
||||
|
||||
delete __webpack_require__.m[id];
|
||||
delete __webpack_require__.c[id];
|
||||
return this._require = __webpack_require__;
|
||||
|
|
|
@ -18,8 +18,8 @@ export default class Modals {
|
|||
static get FormTitle() {return WebpackModules.findByDisplayName("FormTitle");}
|
||||
static get TextElement() {return WebpackModules.getByProps("Sizes", "Weights");}
|
||||
static get ConfirmationModal() {return WebpackModules.findByDisplayName("ConfirmModal");}
|
||||
static get Markdown() {return WebpackModules.findByDisplayName("Markdown");}
|
||||
static get Buttons() {return WebpackModules.getByProps("ButtonColors");}
|
||||
static get Markdown() {return WebpackModules.find(m => m.displayName === "Markdown" && m.rules);}
|
||||
static get Buttons() {return WebpackModules.getByProps("ButtonSizes");}
|
||||
|
||||
static default(title, content) {
|
||||
const modal = DOM.createElement(`<div class="bd-modal-wrapper theme-dark">
|
||||
|
|
Loading…
Reference in New Issue