Files
atom/src/app/atom.coffee
Nathan Sobo b5e2beab96 💄
2012-04-18 10:56:54 -06:00

38 lines
815 B
CoffeeScript

Keymap = require 'keymap'
fs = require 'fs'
$ = require 'jquery'
_ = require 'underscore'
require 'underscore-extensions'
module.exports =
class Atom
keymap: null
windows: null
userConfigurationPath: null
rootViewStates: null
constructor: (@loadPath, nativeMethods) ->
@windows = []
@setUpKeymap()
@userConfigurationPath = fs.absolute "~/.atom/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)