Add events on display add/remove.
This commit is contained in:
parent
809c995c0b
commit
b5898d3355
4 changed files with 138 additions and 20 deletions
|
@ -1,11 +1,6 @@
|
|||
binding = process.atomBinding 'screen'
|
||||
EventEmitter = require('events').EventEmitter
|
||||
|
||||
checkAppIsReady = ->
|
||||
unless process.type is 'renderer' or require('app').isReady()
|
||||
throw new Error('Can not use screen module before the "ready" event of app module gets emitted')
|
||||
screen = process.atomBinding('screen').screen
|
||||
screen.__proto__ = EventEmitter.prototype
|
||||
|
||||
for name, _ of binding
|
||||
do (name) ->
|
||||
module.exports[name] = (args...) ->
|
||||
checkAppIsReady()
|
||||
binding[name](args...)
|
||||
module.exports = screen
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue