2016-03-24 20:15:04 +00:00
|
|
|
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-07-24 12:08:25 +00:00
|
|
|
|
2016-12-01 22:43:30 +00:00
|
|
|
const removeAllListeners = emitter.removeAllListeners.bind(emitter)
|
|
|
|
emitter.removeAllListeners = function (...args) {
|
2016-11-22 07:30:58 +00:00
|
|
|
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)
|
2016-11-22 07:30:58 +00:00
|
|
|
}
|
|
|
|
|
2016-07-24 12:08:25 +00:00
|
|
|
// Do not throw exception when channel name is "error".
|
2016-12-01 22:43:30 +00:00
|
|
|
emitter.on('error', () => {})
|
|
|
|
|
|
|
|
module.exports = emitter
|