Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 03ad21bac9
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (39 sloc) 1.174 kB
//
// WebViewDelegate.m
// phonegap-mac
//
// Created by shazron on 10-04-30.
// Copyright 2010 Nitobi Software Inc. All rights reserved.
//
#import "WebViewDelegate.h"
#import "Sound.h"
@implementation WebViewDelegate
@synthesize sound;
- (void) webView:(WebView*)webView windowScriptObjectAvailable:(WebScriptObject*)windowScriptObject
{
if (self.sound == nil) { self.sound = [Sound new]; }
[windowScriptObject setValue:self.sound forKey:@"sound"];
}
/* This logs all errors from Javascript, nifty */
- (void) webView:(WebView*)webView addMessageToConsole:(NSDictionary*)message
{
if (![message isKindOfClass:[NSDictionary class]]) {
return;
}
NSLog(@"JavaScript error: %@:%@: %@",
[[message objectForKey:@"sourceURL"] lastPathComponent], // could be nil
[message objectForKey:@"lineNumber"],
[message objectForKey:@"message"]);
}
#pragma mark WebScripting protocol
/* checks whether a selector is acceptable to be called from JavaScript */
+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
{
return YES;
}
// right now exclude all properties (eg keys)
+ (BOOL) isKeyExcludedFromWebScript:(const char*)name
{
return YES;
}
@end
Jump to Line
Something went wrong with that request. Please try again.