Skip to content

Commit

Permalink
Made loading class.js optional
Browse files Browse the repository at this point in the history
  • Loading branch information
parmanoir committed Mar 10, 2009
1 parent 67f8248 commit 8c141c3
Show file tree
Hide file tree
Showing 7 changed files with 383 additions and 7,068 deletions.
5 changes: 3 additions & 2 deletions JSCocoa/JSCocoaController.m
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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];
}
}
Expand Down
3 changes: 3 additions & 0 deletions JSLocalizedString/ApplicationController.m
Expand Up @@ -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];
}

Expand All @@ -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];
}

Expand Down

0 comments on commit 8c141c3

Please sign in to comment.