Permalink
Browse files

#21 - Fix deviceready event firing on new BlackBerry 6 devices.

  • Loading branch information...
1 parent 0c183ac commit a015bf0a8f4bb5cf2e527fd57de77301834c4003 @mwbrooks mwbrooks committed May 18, 2011
Showing with 12 additions and 8 deletions.
  1. +12 −8 javascript/device.js
View
@@ -15,13 +15,6 @@
*/
(function() {
/**
- * Check that navigator.device has not been initialized.
- */
- if (typeof navigator.device !== "undefined") {
- return;
- }
-
- /**
* @constructor
*/
function Device() {
@@ -36,7 +29,18 @@
* Define navigator.device.
*/
PhoneGap.addConstructor(function() {
- navigator.device = window.device = new Device();
+ window.device = new Device();
+
+ /* Newer BlackBerry 6 devices now define `navigator.device` */
+ if (typeof navigator.device === 'undefined') {
+ navigator.device = {};
+ }
+
+ /* Add PhoneGap device properties */
+ for (var key in window.device) {
+ navigator.device[key] = window.device[key];
+ }
+
PhoneGap.onPhoneGapInfoReady.fire();
});
}());

0 comments on commit a015bf0

Please sign in to comment.