ipc-main.js 514 B

12345678910111213141516
  1. const EventEmitter = require('events').EventEmitter
  2. const emitter = new EventEmitter()
  3. const removeAllListeners = emitter.removeAllListeners.bind(emitter)
  4. emitter.removeAllListeners = function (...args) {
  5. if (args.length === 0) {
  6. throw new Error('Removing all listeners from ipcMain will make Electron internals stop working. Please specify a event name')
  7. }
  8. removeAllListeners(...args)
  9. }
  10. // Do not throw exception when channel name is "error".
  11. emitter.on('error', () => {})
  12. module.exports = emitter