mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
added onNativeReady and onDOMContentLoaded events
This commit is contained in:
@@ -112,7 +112,6 @@ PhoneGap.Channel.join = function(h, c) {
|
||||
if (!i) h();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Boolean flag indicating if the PhoneGap API is available and initialized.
|
||||
*/ // TODO: Remove this, it is unused here ... -jm
|
||||
@@ -193,6 +192,20 @@ document.addEventListener = function(evt, handler, capture) {
|
||||
}
|
||||
};
|
||||
|
||||
// Intercept calls to document.addEventListener and watch for deviceready
|
||||
PhoneGap._document_addEventListener = document.addEventListener;
|
||||
|
||||
document.addEventListener = function(evt, handler, capture) {
|
||||
if (evt.toLowerCase() == 'deviceready') {
|
||||
PhoneGap.onDeviceReady.sob(handler);
|
||||
} else {
|
||||
PhoneGap._document_addEventListener.call(document, evt, handler);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Execute a PhoneGap command in a queued fashion, to ensure commands do not
|
||||
* execute with any race conditions, and only run when PhoneGap is ready to
|
||||
@@ -331,5 +344,4 @@ PhoneGap.close = function(context, func, params) {
|
||||
return func.apply(context, params);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user