mirror of
https://github.com/atom/atom.git
synced 2026-02-10 06:35:00 -05:00
Implement atom.open using atom.sendMessageToBrowserProcess
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user