CSS editor fixes

This commit is contained in:
Samuel Elliott 2018-03-22 02:37:30 +00:00
parent ebff286c31
commit 5e8e9fa19f
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
4 changed files with 6 additions and 31 deletions

View File

@ -12,7 +12,7 @@ import { ipcRenderer } from 'electron';
const callbacks = new WeakMap();
export default new class ClientIPC {
const ClientIPC = new class ClientIPC {
constructor() {
this.on('ping', () => 'pong', true);
@ -114,6 +114,8 @@ export default new class ClientIPC {
}
export default ClientIPC;
/**
* An IPC event.
*/

View File

@ -1,28 +0,0 @@
const { ipcRenderer } = window.require('electron');
export default class {
static on(channel, cb) {
ipcRenderer.on(channel, (event, args) => cb(event, args));
}
static async send(channel, message) {
const __eid = Date.now().toString();
ipcRenderer.send(
channel.startsWith('bd-') ? channel: `bd-${channel}`,
message === undefined ? { __eid } : Object.assign(message, { __eid })
);
return new Promise((resolve, reject) => {
ipcRenderer.once(__eid, (event, arg) => {
if (arg.err) return reject(arg);
resolve(arg);
});
});
}
static sendToDiscord(channel, message) {
this.send('bd-sendToDiscord', { channel, message });
}
}

View File

@ -17,7 +17,7 @@ module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'csseditor.js'
filename: 'csseditor-release.js'
},
module: {
loaders: [vueLoader, scssLoader]

View File

@ -58,7 +58,8 @@ const index = function() {
const cssEditor = function() {
return pump([
gulp.src('./csseditor/dist/**/*'),
gulp.src('./csseditor/dist/csseditor-release.js'),
rename('csseditor.js'),
copy('release/csseditor', { prefix: 2 })
]);
};