mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 23:25:11 +08:00
Need to listen for XHR callbacks before constructors are run, since constructors could call native code that returns data in callback.
This commit is contained in:
parent
ace84227cc
commit
b079a24373
@ -223,18 +223,15 @@ if (typeof _nativeReady !== 'undefined') { PhoneGap.onNativeReady.fire(); }
|
|||||||
*/
|
*/
|
||||||
PhoneGap.onDeviceReady = new PhoneGap.Channel('onDeviceReady');
|
PhoneGap.onDeviceReady = new PhoneGap.Channel('onDeviceReady');
|
||||||
|
|
||||||
/**
|
|
||||||
* Start listening for XHR callbacks onDeviceReady
|
|
||||||
*/
|
|
||||||
PhoneGap.onDeviceReady.subscribeOnce(function() {
|
|
||||||
PhoneGap.JSCallback();
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create all PhoneGap objects once page has fully loaded and native side is ready.
|
* Create all PhoneGap objects once page has fully loaded and native side is ready.
|
||||||
*/
|
*/
|
||||||
PhoneGap.Channel.join(function() {
|
PhoneGap.Channel.join(function() {
|
||||||
|
|
||||||
|
// Start listening for XHR callbacks
|
||||||
|
PhoneGap.JSCallback();
|
||||||
|
|
||||||
// Run PhoneGap constructors
|
// Run PhoneGap constructors
|
||||||
PhoneGap.onPhoneGapInit.fire();
|
PhoneGap.onPhoneGapInit.fire();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user