Implement atom.open using atom.sendMessageToBrowserProcess

This commit is contained in:
Nathan Sobo
2012-08-28 16:47:19 -05:00
parent 87a0f93149
commit 502e52f37d
3 changed files with 4 additions and 42 deletions

View File

@@ -1,39 +1,2 @@
Keymap = require 'keymap'
fs = require 'fs'
$ = require 'jquery'
_ = require 'underscore'
require 'underscore-extensions'
module.exports =
class Atom
keymap: null
windows: null
configFilePath: null
configDirPath: null
rootViewStates: null
constructor: (@loadPath, nativeMethods) ->
@windows = []
@setUpKeymap()
@configDirPath = fs.absolute("~/.atom")
@configFilePath = fs.join(@configDirPath, "atom.coffee")
@rootViewStates = {}
setUpKeymap: ->
@keymap = new Keymap()
@handleKeyEvent = (e) => @keymap.handleKeyEvent(e)
$(document).on 'keydown', @handleKeyEvent
@keymap.bindDefaultKeys()
open: (path) ->
$native.open path
quit: ->
$native.terminate null
windowOpened: (window) ->
@windows.push(window) unless _.contains(@windows, window)
windowClosed: (window) ->
_.remove(@windows, window)
atom.open = (args...) ->
@sendMessageToBrowserProcess('open', args)