refactor: use separate ipc-renderer-internal / ipc-main-internal APIs for Electron internals (#13940)

This commit is contained in:
Milan Burda 2018-10-06 13:48:00 +02:00 committed by Samuel Attard
parent f7122610cc
commit b50f86ef43
49 changed files with 322 additions and 133 deletions

View file

@ -1,17 +1,9 @@
'use strict'
const EventEmitter = require('events').EventEmitter
const { EventEmitter } = require('events')
const emitter = new EventEmitter()
const removeAllListeners = emitter.removeAllListeners.bind(emitter)
emitter.removeAllListeners = function (...args) {
if (args.length === 0) {
throw new Error('Removing all listeners from ipcMain will make Electron internals stop working. Please specify a event name')
}
removeAllListeners(...args)
}
// Do not throw exception when channel name is "error".
emitter.on('error', () => {})