Add handleEvent
method:
handleEvent(payload, sender, event) {
this.metadata.webContents.send(event, payload);
}
Subscribe on event emit
in method serviceCreated
:
ipcMain.on('emit', async (event, notification) => {
if (!this.metadata.webContents) this.metadata.webContents = event.sender;
this.broker.emit(notification.event, notification.payload);
});
Finally, declare event handlers in a service schema definition:
events: {
'compressor.*': this.handleEvent,
'thumbnail.*': this.handleEvent
}