You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/03/16 19:14:49 UTC

[29/29] ios commit: tell webview that native is ready after didFinishLoad

tell webview that native is ready after didFinishLoad


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/b886bec3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/b886bec3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/b886bec3

Branch: refs/heads/master
Commit: b886bec3997f7d3488db3c14d4be910ead80fd97
Parents: c00604c
Author: Fil Maj <fi...@nitobi.com>
Authored: Thu Feb 23 10:51:28 2012 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Fri Mar 16 10:56:48 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/b886bec3/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 306a894..680483d 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -398,6 +398,10 @@
     }
     
     [self didRotateFromInterfaceOrientation:(UIInterfaceOrientation)[[UIDevice currentDevice] orientation]];
+    
+    // Tell the webview that native is ready.
+    NSString* nativeReady = @"try{require('cordova/channel').onNativeReady.fire();}catch(e){window._nativeReady = true;}";
+    [theWebView stringByEvaluatingJavaScriptFromString:nativeReady];
 }
 
 - (void) webView:(UIWebView*)webView didFailLoadWithError:(NSError*)error 
@@ -815,6 +819,7 @@ BOOL gSplashScreenShown = NO;
     [devProps setObject:[device name] forKey:@"name"];
     [devProps setObject:[[self class] cordovaVersion ] forKey:@"gap"];
     
+    // TODO: why do we blast this onto the device object? can't we just leave it alone as a plugin?
     id cmd = [self.commandDelegate getCommandInstance:@"org.apache.cordova.connection"];
     if (cmd && [cmd isKindOfClass:[CDVConnection class]]) 
     {