mirror of
https://github.com/atom/atom.git
synced 2026-02-16 09:35:54 -05:00
jscocoa.js holds a subset of the methods from jscocoa's class.js
This commit is contained in:
15
src/jscocoa.coffee
Normal file
15
src/jscocoa.coffee
Normal 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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user