Permalink
Browse files

Removed ejecta.loadText & ejecta.getText; use XMLHttpRequest instead

  • Loading branch information...
phoboslab committed Nov 7, 2012
1 parent 45e55d4 commit 445eb1530bf3344f9245ffbe5b3d7704a175b628
Showing with 0 additions and 20 deletions.
  1. +0 −20 Classes/Ejecta/EJBindingEjectaCore.m
@@ -27,26 +27,6 @@ - (void)dealloc {
return NULL;
}
-EJ_BIND_FUNCTION(loadText, ctx, argc, argv) {
- if( argc < 1 ) { return NULL; }
-
- NSString * path = [[EJApp instance] pathForResource:JSValueToNSString(ctx, argv[0])];
- NSString * text = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL];
- return NSStringToJSValue(ctx, text);
-}
-
-EJ_BIND_FUNCTION(loadJSON, ctx, argc, argv) {
- if( argc < 1 ) { return NULL; }
-
- NSString * path = [[EJApp instance] pathForResource:JSValueToNSString(ctx, argv[0])];
- NSString * text = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL];
-
- JSStringRef jsText = JSStringCreateWithCFString((CFStringRef)text);;
- JSValueRef json = JSValueMakeFromJSONString(ctx, jsText);
- JSStringRelease(jsText);
- return json;
-}
-
EJ_BIND_FUNCTION(openURL, ctx, argc, argv ) {
if( argc < 1 ) { return NULL; }

2 comments on commit 445eb15

@samowitsch

This comment has been minimized.

Show comment Hide comment
@samowitsch

samowitsch Nov 8, 2012

I found these functions very useful ;-(

I found these functions very useful ;-(

@phoboslab

This comment has been minimized.

Show comment Hide comment
@phoboslab

phoboslab Nov 9, 2012

Owner

I believe it's a good idea to have methods that work in both, the browser and Ejecta whenever possible. Hence, allowing XMLHttpRequest in Ejecta to access local files is "better" than a proprietary function.

You should be able to replicate loadJSON and loadText in JS with XMLHttpRequest if you need a shorthand.

Owner

phoboslab replied Nov 9, 2012

I believe it's a good idea to have methods that work in both, the browser and Ejecta whenever possible. Hence, allowing XMLHttpRequest in Ejecta to access local files is "better" than a proprietary function.

You should be able to replicate loadJSON and loadText in JS with XMLHttpRequest if you need a shorthand.

Please sign in to comment.