Permalink
Browse files

Made loading class.js optional

  • Loading branch information...
1 parent 67f8248 commit 8c141c3335e5b7f30a08264dd3dfad0d415a3d48 @parmanoir committed Mar 10, 2009
@@ -179,7 +179,8 @@ - (id)init
#endif
// Load class kit
- [self evalJSFile:[[NSBundle bundleForClass:[self class]] pathForResource:@"class" ofType:@"js"]];
+ id classKitPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"class" ofType:@"js"];
+ if ([[NSFileManager defaultManager] fileExistsAtPath:classKitPath]) [self evalJSFile:classKitPath];
return self;
}
@@ -243,7 +244,7 @@ + (id)sharedController
// Why ? if init is calling sharedController, the pointer won't have been set and it will call itself over and over again.
//
JSCocoaSingleton = [self alloc];
- NSLog(@"JSCocoa : allocating shared instance %x", JSCocoaSingleton);
+// NSLog(@"JSCocoa : allocating shared instance %x", JSCocoaSingleton);
[JSCocoaSingleton init];
}
}
@@ -23,6 +23,7 @@ - (void)awakeFromNib
{
id str = JSLocalizedString(@"BookCount", [NSNumber numberWithInt:bookCount], nil);
NSLog(@"init %d %@", bookCount, str);
+ if (!str) str = @"***Localization not found***";
[label setStringValue:str];
}
@@ -31,13 +32,15 @@ - (IBAction)add:(id)sender
bookCount++;
id str = JSLocalizedString(@"BookCount", [NSNumber numberWithInt:bookCount], nil);
NSLog(@"add %d %@", bookCount, str);
+ if (!str) str = @"***Localization not found***";
[label setStringValue:str];
}
- (IBAction)remove:(id)sender
{
if (bookCount > 0) bookCount--;
id str = JSLocalizedString(@"BookCount", [NSNumber numberWithInt:bookCount], nil);
NSLog(@"remove %d", bookCount);
+ if (!str) str = @"***Localization not found***";
[label setStringValue:str];
}
Oops, something went wrong.

0 comments on commit 8c141c3

Please sign in to comment.