loading frames with their own JSCocoa OSX objects

This commit is contained in:
Corey Johnson
2011-08-23 17:25:02 -07:00
parent 3d8545bbb0
commit bae0ab2e6b
7 changed files with 52 additions and 42 deletions

View File

@@ -8,7 +8,6 @@
#import <Cocoa/Cocoa.h>
@interface AtomWindowController : NSWindowController {
IBOutlet id webView;
NSString *URL;

View File

@@ -26,7 +26,10 @@
[self setShouldCascadeWindows:NO];
[self setWindowFrameAutosaveName:@"atomWindow"];
[webView setFrameLoadDelegate:self];
if (self.URL) {
[webView setMainFrameURL:self.URL];
} else {
@@ -36,10 +39,13 @@
NSString *html = [NSString stringWithContentsOfURL:indexURL encoding:NSUTF8StringEncoding error:nil];;
[[webView mainFrame] loadHTMLString:html baseURL:htmlURL];
}
// https://github.com/parmanoir/jscocoa#readme
JSCocoa* jsc = [[JSCocoa alloc] initWithGlobalContext:[[webView mainFrame] globalContext]];
[jsc setObject:self withName:@"App"];
}
- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
// https://github.com/parmanoir/jscocoa#readme
JSCocoa* jsc = [[JSCocoa alloc] initWithGlobalContext:[frame globalContext]];
[jsc setObject:self withName:@"App"];
}
@end

View File

@@ -252,7 +252,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$PROJECT_DIR/script/compile.sh\"";
shellScript = "\"$PROJECT_DIR/script/compile.sh\" ";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

32
HTML/editor.html Normal file
View File

@@ -0,0 +1,32 @@
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
}
#editor {
position: absolute;
width: 100%;
height: 100%;
font: 18px Inconsolada, Monaco, Courier;
}
</style>
</head>
<body>
<div id="editor"></div>
<script src="ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="ace/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
<script src="ace/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
<script src="ace/mode-coffee.js" type="text/javascript" charset="utf-8"></script>
<script src="ace/mode-html.js" type="text/javascript" charset="utf-8"></script>
<script src="underscore.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="coffee-script.js" type="text/javascript" charset="utf-8"></script>
<script src="osx.js" type="text/javascript" charset="utf-8"></script>
<script src="atomicity.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>

View File

@@ -1,28 +1,8 @@
<style>
* {
margin: 0;
padding: 0;
}
#editor {
position: absolute;
width: 100%;
height: 100%;
font: 18px Inconsolada, Monaco, Courier;
}
</style>
<div id="editor"></div>
<script src="ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="ace/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
<script src="ace/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
<script src="ace/mode-coffee.js" type="text/javascript" charset="utf-8"></script>
<script src="ace/mode-html.js" type="text/javascript" charset="utf-8"></script>
<script src="underscore.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="coffee-script.js" type="text/javascript" charset="utf-8"></script>
<script src="osx.js" type="text/javascript" charset="utf-8"></script>
<script src="atomicity.js" type="text/javascript" charset="utf-8"></script>
<style>
</style>
<html>
<head>
</head>
<frameset cols = "25%, *">
<frame src ="project.html" />
<frame src ="editor.html" />
</frameset>
</html>

0
HTML/project.html Normal file
View File

View File

@@ -1,7 +0,0 @@
#!/bin/sh
SOURCE_SCRIPTS_DIR="$PROJECT_DIR/HTML"
DESTINATION_SCRIPTS_DIR="$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Resources/"
cp -r "$SOURCE_SCRIPTS_DIR" "$DESTINATION_SCRIPTS_DIR"
echo "$DESTINATION_SCRIPTS_DIR"