Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'upstream/master'

  • Loading branch information...
commit f41e26cec05838329cd220451e8bec593eef4401 2 parents bdcaad9 + 7f0cd1e
@broderix broderix authored
View
23 BlackBerry/BarcodeScanner/barcodescanner.js
@@ -38,7 +38,7 @@ var BarcodeScanner = BarcodeScanner || (function() {
/**
* Check that window.plugins.barcodeScanner has not been initialized.
*/
- if (typeof window.plugins.barcodeScanner !== "undefined") {
+ if (typeof window.plugins !== "undefined" && typeof window.plugins.barcodeScanner !== "undefined") {
return;
}
@@ -146,9 +146,24 @@ var BarcodeScanner = BarcodeScanner || (function() {
}, 'BarcodeScanner', 'encode', params);
};
- cordova.addConstructor(function() {
- cordova.addPlugin('barcodeScanner', new BarcodeScanner());
- });
+ /**
+ * Initialize BarcodeScanner global reference
+ */
+ if (cordova && (typeof cordova.addConstructor === "function") &&
+ (typeof cordova.addPlugin === "function")) {
+ // Cordova 1.6 - 1.8.1
+ cordova.addConstructor(function() {
+ cordova.addPlugin('barcodeScanner', new BarcodeScanner());
+ });
+ } else {
+ // Cordova 2.0
+ if (!window.plugins) {
+ window.plugins = {};
+ }
+ if (!window.plugins.barcodeScanner) {
+ window.plugins.barcodeScanner = new BarcodeScanner();
+ }
+ }
/**
* Return an object that contains the static constants.
View
20 BlackBerry/ChildBrowser/www/childbrowser.js
@@ -94,9 +94,21 @@ var ChildBrowser = ChildBrowser || (function() {
};
/**
- * Load ChildBrowser
+ * Initialize ChildBrowser global reference
*/
- cordova.addConstructor(function() {
- cordova.addPlugin("childBrowser", new ChildBrowser());
- });
+ if (cordova && (typeof cordova.addConstructor === "function") &&
+ (typeof cordova.addPlugin === "function")) {
+ // Cordova 1.6 - 1.8.1
+ cordova.addConstructor(function() {
+ cordova.addPlugin("childBrowser", new ChildBrowser());
+ });
+ } else {
+ // Cordova 2.0
+ if (!window.plugins) {
+ window.plugins = {};
+ }
+ if (!window.plugins.childBrowser) {
+ window.plugins.childBrowser = new ChildBrowser();
+ }
+ }
})();
Please sign in to comment.
Something went wrong with that request. Please try again.