mime-chat/src/composables/useEmitter.ts
2021-06-16 08:42:47 -05:00

16 lines
330 B
TypeScript

// Backend emitter
//
const EventEmitter = require('events');
class BackgroundMitt extends EventEmitter { }
export const backgroundMitt = new BackgroundMitt();
export const ipcEmit = (channel: string, payload: any) => {
backgroundMitt.emit('ipc-renderer', {
endpoint: channel,
message: payload
});
};