cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/2] js commit: check the window.cordova object a little more strictly
Date Wed, 06 May 2015 04:05:30 GMT
Repository: cordova-js
Updated Branches:
  refs/heads/master 69ae6c979 -> d810710c1


check the window.cordova object a little more strictly


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/413c874d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/413c874d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/413c874d

Branch: refs/heads/master
Commit: 413c874db3e419b7f8219901bd591c8c901d2696
Parents: 69ae6c9
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Mon May 4 17:47:52 2015 -0700
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Mon May 4 17:47:52 2015 -0700

----------------------------------------------------------------------
 src/cordova.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/413c874d/src/cordova.js
----------------------------------------------------------------------
diff --git a/src/cordova.js b/src/cordova.js
index 1f1b92d..ed1a582 100644
--- a/src/cordova.js
+++ b/src/cordova.js
@@ -19,12 +19,16 @@
  *
 */
 
-if ("cordova" in window) { throw new Error("cordova already defined"); };
+
 
 
 var channel = require('cordova/channel');
 var platform = require('cordova/platform');
 
+if (window.cordova && window.cordova.platformId && window.cordova.platformId
== platform.id){ 
+    throw new Error("cordova already defined"); 
+};
+
 /**
  * Intercept calls to addEventListener + removeEventListener and handle deviceready,
  * resume, and pause events.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message