singletons that are retroactively turned into EventEmitters should call the EventEmitter ctor
This commit is contained in:
parent
577012370e
commit
1c09dede1a
7 changed files with 14 additions and 0 deletions
|
@ -10,7 +10,9 @@ const electron = require('electron')
|
|||
const {deprecate, Menu} = electron
|
||||
const {EventEmitter} = require('events')
|
||||
|
||||
// App is an EventEmitter.
|
||||
Object.setPrototypeOf(App.prototype, EventEmitter.prototype)
|
||||
EventEmitter.call(app)
|
||||
|
||||
Object.assign(app, {
|
||||
setApplicationMenu (menu) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
const EventEmitter = require('events').EventEmitter
|
||||
const {autoUpdater, AutoUpdater} = process.atomBinding('auto_updater')
|
||||
|
||||
// AutoUpdater is an EventEmitter.
|
||||
Object.setPrototypeOf(AutoUpdater.prototype, EventEmitter.prototype)
|
||||
EventEmitter.call(autoUpdater)
|
||||
|
||||
module.exports = autoUpdater
|
||||
|
|
|
@ -9,7 +9,10 @@ const {Session} = process.atomBinding('session')
|
|||
const {net, Net} = process.atomBinding('net')
|
||||
const {URLRequest} = net
|
||||
|
||||
// Net is an EventEmitter.
|
||||
Object.setPrototypeOf(Net.prototype, EventEmitter.prototype)
|
||||
EventEmitter.call(net)
|
||||
|
||||
Object.setPrototypeOf(URLRequest.prototype, EventEmitter.prototype)
|
||||
|
||||
const kSupportedProtocols = new Set(['http:', 'https:'])
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const {powerMonitor, PowerMonitor} = process.atomBinding('power_monitor')
|
||||
|
||||
// PowerMonitor is an EventEmitter.
|
||||
Object.setPrototypeOf(PowerMonitor.prototype, EventEmitter.prototype)
|
||||
EventEmitter.call(powerMonitor)
|
||||
|
||||
module.exports = powerMonitor
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const {screen, Screen} = process.atomBinding('screen')
|
||||
|
||||
// Screen is an EventEmitter.
|
||||
Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype)
|
||||
EventEmitter.call(screen)
|
||||
|
||||
module.exports = screen
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const {systemPreferences, SystemPreferences} = process.atomBinding('system_preferences')
|
||||
|
||||
// SystemPreferences is an EventEmitter.
|
||||
Object.setPrototypeOf(SystemPreferences.prototype, EventEmitter.prototype)
|
||||
EventEmitter.call(systemPreferences)
|
||||
|
||||
module.exports = systemPreferences
|
||||
|
|
|
@ -5,6 +5,7 @@ const {webFrame, WebFrame} = process.atomBinding('web_frame')
|
|||
|
||||
// WebFrame is an EventEmitter.
|
||||
Object.setPrototypeOf(WebFrame.prototype, EventEmitter.prototype)
|
||||
EventEmitter.call(webFrame)
|
||||
|
||||
// Lots of webview would subscribe to webFrame's events.
|
||||
webFrame.setMaxListeners(0)
|
||||
|
|
Loading…
Reference in a new issue