Making it require'y

This commit is contained in:
Corey Johnson 2011-08-26 17:05:05 -07:00
parent 90773a8930
commit 853980b188
2 changed files with 20 additions and 8 deletions

View File

@ -1,4 +1,15 @@
# This file is the first thing loaded on startup.
c = AtomWindowController.alloc.initWithWindowNibName "AtomWindow"
c.window
modules = {}
this.require = (path) ->
console.log(path)
return modules[path] if modules[path]
root = OSX.NSBundle.mainBundle.resourcePath + '/HTML/'
file = OSX.NSString.stringWithContentsOfFile "#{root}/#{path}.js"
exports = {}
eval "(function(exports){#{file}}).call(exports, exports);"
modules[path] = exports
modules[path]

View File

@ -1,7 +1,6 @@
# This is the CoffeeScript API that wraps all of Cocoa.
# leak
canon = require 'pilot/canon'
{canon} = require 'pilot/canon'
# Handles the UI chrome
Chrome =
@ -161,7 +160,9 @@ Project =
@showing = not @showing
this.Chrome = Chrome
this.File = File
this.Dir = Dir
this.Project = Project
exports ?= this
exports.Chrome = Chrome
exports.File = File
exports.Dir = Dir
exports.Project = Project