You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2012/09/21 17:32:19 UTC
ios commit: Add a comment explaining what the statements in the
nativeReady eval do.
Updated Branches:
refs/heads/master 0c0b87bca -> 6fa7f3d24
Add a comment explaining what the statements in the nativeReady eval do.
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/6fa7f3d2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/6fa7f3d2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/6fa7f3d2
Branch: refs/heads/master
Commit: 6fa7f3d24c1f2aed951b28a6bb0d098b8d35eff6
Parents: 0c0b87b
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Sep 21 11:31:36 2012 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Sep 21 11:31:36 2012 -0400
----------------------------------------------------------------------
CordovaLib/Classes/CDVViewController.m | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/6fa7f3d2/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 5dae1ab..2121363 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -503,7 +503,9 @@
}
[self didRotateFromInterfaceOrientation:(UIInterfaceOrientation)[[UIDevice currentDevice] orientation]];
- // Tell the webview that native is ready.
+ // The iOSVCAddr is used to identify the WebView instance when using one of the XHR js->native bridge modes.
+ // The .onNativeReady().fire() will work when cordova.js is already loaded.
+ // The _nativeReady = true; is used when this is run before cordova.js is loaded.
NSString* nativeReady = [NSString stringWithFormat:@"cordova.iOSVCAddr='%lld';try{cordova.require('cordova/channel').onNativeReady.fire();}catch(e){window._nativeReady = true;}", (long long)self];
[theWebView stringByEvaluatingJavaScriptFromString:nativeReady];
}