electron/lib/browser/api/ipc-main.js
2016-12-01 14:56:00 -08:00

16 lines
514 B
JavaScript

const EventEmitter = require('events').EventEmitter
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', () => {})
module.exports = emitter