Use require('electron') in Electron's code

This commit is contained in:
Cheng Zhao 2015-11-12 18:28:04 +08:00
parent f9d7e7ce55
commit 1d1f911b09
71 changed files with 265 additions and 250 deletions

View file

@ -1,5 +1,5 @@
deprecate = require 'deprecate'
EventEmitter = require('events').EventEmitter
electron = require 'electron'
{EventEmitter} = require 'events'
bindings = process.atomBinding 'app'
sessionBindings = process.atomBinding 'session'
@ -9,10 +9,10 @@ app = bindings.app
app.__proto__ = EventEmitter.prototype
app.setApplicationMenu = (menu) ->
require('menu').setApplicationMenu menu
electron.menu.setApplicationMenu menu
app.getApplicationMenu = ->
require('menu').getApplicationMenu()
electron.menu.getApplicationMenu()
app.commandLine =
appendSwitch: bindings.appendSwitch,
@ -39,6 +39,7 @@ app.getAppPath = ->
app.resolveProxy = (url, callback) -> @defaultSession.resolveProxy url, callback
# Deprecated.
{deprecate} = electron
app.getHomeDir = deprecate 'app.getHomeDir', 'app.getPath', ->
@getPath 'home'
app.getDataPath = deprecate 'app.getDataPath', 'app.getPath', ->