Use ES6 imports/exports
This commit is contained in:
parent
bba1165c77
commit
1de4680ded
|
@ -8,11 +8,11 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const sass = require('node-sass');
|
||||
const { BrowserWindow, dialog } = require('electron');
|
||||
import path from 'path';
|
||||
import sass from 'node-sass';
|
||||
import { BrowserWindow, dialog } from 'electron';
|
||||
|
||||
const { FileUtils, BDIpc, Config, WindowUtils, CSSEditor, Database } = require('./modules');
|
||||
import { FileUtils, BDIpc, Config, WindowUtils, CSSEditor, Database } from './modules';
|
||||
|
||||
const tests = typeof PRODUCTION === 'undefined';
|
||||
|
||||
|
@ -117,7 +117,7 @@ class Comms {
|
|||
}
|
||||
}
|
||||
|
||||
class BetterDiscord {
|
||||
export class BetterDiscord {
|
||||
|
||||
constructor(args) {
|
||||
if (BetterDiscord.loaded) {
|
||||
|
@ -225,7 +225,3 @@ class BetterDiscord {
|
|||
}
|
||||
|
||||
BetterDiscord.patchBrowserWindow();
|
||||
|
||||
module.exports = {
|
||||
BetterDiscord
|
||||
};
|
||||
|
|
|
@ -8,16 +8,15 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const { ipcMain } = require('electron');
|
||||
|
||||
const { Module } = require('./modulebase');
|
||||
import { ipcMain } from 'electron';
|
||||
import Module from './modulebase';
|
||||
|
||||
const callbacks = new WeakMap();
|
||||
|
||||
/**
|
||||
* The IPC module used in the main process.
|
||||
*/
|
||||
class BDIpc {
|
||||
export default class BDIpc {
|
||||
|
||||
/**
|
||||
* Adds an IPC event listener.
|
||||
|
@ -76,7 +75,7 @@ class BDIpc {
|
|||
|
||||
}
|
||||
|
||||
class BDIpcEvent extends Module {
|
||||
export class BDIpcEvent extends Module {
|
||||
|
||||
constructor(event, args) {
|
||||
super(args);
|
||||
|
@ -117,5 +116,3 @@ class BDIpcEvent extends Module {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = { BDIpc };
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const { Module } = require('./modulebase');
|
||||
import Module from './modulebase';
|
||||
|
||||
class Config extends Module {
|
||||
export default class Config extends Module {
|
||||
|
||||
get version() {
|
||||
return this.args.version;
|
||||
|
@ -33,5 +33,3 @@ class Config extends Module {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = { Config };
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const { BrowserWindow } = require('electron');
|
||||
import path from 'path';
|
||||
import { BrowserWindow } from 'electron';
|
||||
|
||||
const { Module } = require('./modulebase');
|
||||
const { WindowUtils } = require('./utils');
|
||||
const { BDIpc } = require('./bdipc');
|
||||
import Module from './modulebase';
|
||||
import { WindowUtils } from './utils';
|
||||
import BDIpc from './bdipc';
|
||||
|
||||
class CSSEditor extends Module {
|
||||
export default class CSSEditor extends Module {
|
||||
|
||||
constructor(bd, path) {
|
||||
super();
|
||||
|
@ -91,5 +91,3 @@ class CSSEditor extends Module {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = { CSSEditor };
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const Datastore = require('nedb');
|
||||
import Datastore from 'nedb';
|
||||
|
||||
class Database {
|
||||
export default class Database {
|
||||
|
||||
constructor(dbPath) {
|
||||
this.exec = this.exec.bind(this);
|
||||
|
@ -67,5 +67,3 @@ class Database {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = { Database };
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export { BDIpc } from './bdipc';
|
||||
export { default as BDIpc } from './bdipc';
|
||||
export { Utils, FileUtils, WindowUtils } from './utils';
|
||||
export { Config } from './config';
|
||||
export { CSSEditor } from './csseditor';
|
||||
export { Database } from './database';
|
||||
export { default as Config } from './config';
|
||||
export { default as CSSEditor } from './csseditor';
|
||||
export { default as Database } from './database';
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
/**
|
||||
* Base Module that every non-static module should extend.
|
||||
*/
|
||||
class Module {
|
||||
export default class Module {
|
||||
|
||||
constructor(args) {
|
||||
this.__ = {
|
||||
|
@ -31,5 +31,3 @@ class Module {
|
|||
get state() { return this.__.state; }
|
||||
|
||||
}
|
||||
|
||||
module.exports = { Module };
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
// TODO Use common
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
const { Module } = require('./modulebase');
|
||||
const { BDIpc } = require('./bdipc');
|
||||
import Module from './modulebase';
|
||||
import BDIpc from './bdipc';
|
||||
|
||||
class Utils {
|
||||
export class Utils {
|
||||
static async tryParseJson(jsonString) {
|
||||
try {
|
||||
return JSON.parse(jsonString);
|
||||
|
@ -29,7 +29,7 @@ class Utils {
|
|||
}
|
||||
}
|
||||
|
||||
class FileUtils {
|
||||
export class FileUtils {
|
||||
static async fileExists(path) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.stat(path, (err, stats) => {
|
||||
|
@ -158,7 +158,7 @@ class FileUtils {
|
|||
}
|
||||
}
|
||||
|
||||
class WindowUtils extends Module {
|
||||
export class WindowUtils extends Module {
|
||||
bindings() {
|
||||
this.openDevTools = this.openDevTools.bind(this);
|
||||
this.executeJavascript = this.executeJavascript.bind(this);
|
||||
|
@ -209,9 +209,3 @@ class WindowUtils extends Module {
|
|||
return BDIpc.send(this.window, channel, message);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
Utils,
|
||||
FileUtils,
|
||||
WindowUtils
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue