jscocoa.js holds a subset of the methods from jscocoa's class.js

This commit is contained in:
Corey Johnson
2011-08-29 17:02:41 -07:00
parent 21f3584924
commit 88d157178b
2 changed files with 19 additions and 3 deletions

15
src/jscocoa.coffee Normal file
View File

@@ -0,0 +1,15 @@
# This is where we put things from JSCocoa's class.js file
exports.outArgument = (args...) ->
# Derive to store some javascript data in the internal hash
if not @outArgument2?
OSX.JSCocoa.createClass_parentClass_('JSCocoaOutArgument2', 'JSCocoaOutArgument')
console.log(OSX.JSCocoaOutArgument2)
o = OSX.JSCocoaOutArgument2.instance
o.isOutArgument = true
if args.length == 2
o.mateWithMemoryBuffer_atIndex_(args[0], args[1])
o

View File

@@ -2,6 +2,7 @@
$ = require 'jquery'
_ = require 'underscore'
jscocoa = require 'jscocoa'
# Handles the UI chrome
Chrome =
@@ -25,11 +26,11 @@ Chrome =
else
throw "I DON'T KNOW HOW TO DEAL WITH #{position}"
# path - Optional. The String path to the file to base it on.
inspector: (webView) ->
webView ?= WindowController.webView
@_inspector ?= OSX.WebInspector.alloc.initWithWebView webView
# path - Optional. The String path to the file to base it on.
createWindow: (path) ->
c = OSX.AtomWindowController.alloc.initWithWindowNibName "AtomWindow"
c.window
@@ -92,7 +93,7 @@ File =
else
path
isFile: (path) ->
isDir = new outArgument
isDir = new jscocoa.outArgument
exists = OSX.NSFileManager.defaultManager.fileExistsAtPath_isDirectory(path, isDir)
exists and not isDir.valueOf()
@@ -106,7 +107,7 @@ Dir =
paths = fm.contentsOfDirectoryAtPath_error path, null
_.map paths, (entry) -> "#{path}/#{entry}"
isDir: (path) ->
isDir = new outArgument
isDir = new jscocoa.outArgument
exists = OSX.NSFileManager.defaultManager.fileExistsAtPath_isDirectory(path, isDir)
exists and isDir.valueOf()