Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Little bit o' abstraction.

  • Loading branch information...
commit 301d7a588286f825cb9a1589361e17476015a134 1 parent f1e7c69
@ccgus authored
Showing with 16 additions and 0 deletions.
  1. +4 −0 src/JSTalk.h
  2. +12 −0 src/JSTalk.m
View
4 src/JSTalk.h
@@ -41,3 +41,7 @@
+ (JSTalk*)currentJSTalk;
@end
+
+@interface NSObject (JSTalkDelegate)
+- (void)JSTalk:(JSTalk*)jstalk hadError:(NSString*)error onLineNumber:(NSInteger)lineNumber atSourceURL:(id)url;
+@end
View
12 src/JSTalk.m
@@ -239,6 +239,13 @@ - (void)deleteObjectWithName:(NSString*)name {
JSStringRelease(jsName);
}
+- (void)JSCocoa:(JSCocoaController*)controller hadError:(NSString*)error onLineNumber:(NSInteger)lineNumber atSourceURL:(id)url {
+
+ if (_errorController && [_errorController respondsToSelector:@selector(JSTalk:hadError:onLineNumber:atSourceURL:)]) {
+ [_errorController JSTalk:self hadError:error onLineNumber:lineNumber atSourceURL:url];
+ }
+}
+
- (id)executeString:(NSString*)str {
@@ -257,6 +264,11 @@ - (id)executeString:(NSString*)str {
id resultObj = 0x00;
@try {
+
+ if (![_jsController delegate]) {
+ [_jsController setDelegate:self];
+ }
+
[_jsController setUseAutoCall:NO];
[_jsController setUseJSLint:NO];
resultRef = [_jsController evalJSString:[NSString stringWithFormat:@"function print(s) { jstalk.print_(s); } var nil=null; %@", str]];
Please sign in to comment.
Something went wrong with that request. Please try again.