electron/lib/browser/api/ipc-main.js

17 lines
514 B
JavaScript
Raw Normal View History

const EventEmitter = require('events').EventEmitter
2016-01-12 02:40:23 +00:00
2016-12-01 22:43:30 +00:00
const emitter = new EventEmitter()
2016-12-01 22:43:30 +00:00
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')
}
2016-12-01 22:43:30 +00:00
removeAllListeners(...args)
}
// Do not throw exception when channel name is "error".
2016-12-01 22:43:30 +00:00
emitter.on('error', () => {})
module.exports = emitter