You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ripple.apache.org by ti...@apache.org on 2015/06/18 19:29:46 UTC
incubator-ripple git commit: RIPPLE-89 Battery Status panel throws
exception if no cordova.js.
Repository: incubator-ripple
Updated Branches:
refs/heads/master 139105001 -> 379d630da
RIPPLE-89 Battery Status panel throws exception if no cordova.js.
Instead of throwing an exception when cordova.js is not present, just fail silently.
This closes #61
Project: http://git-wip-us.apache.org/repos/asf/incubator-ripple/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ripple/commit/379d630d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ripple/tree/379d630d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ripple/diff/379d630d
Branch: refs/heads/master
Commit: 379d630da260306bdf8321fd7f708912173719a2
Parents: 1391050
Author: Julian Horn <ju...@intel.com>
Authored: Thu Jun 18 10:40:43 2015 -0400
Committer: Tim Barham <ti...@microsoft.com>
Committed: Thu Jun 18 10:28:37 2015 -0700
----------------------------------------------------------------------
lib/client/platform/cordova/2.0.0/spec/events.js | 7 +++----
lib/client/ui/plugins/batteryStatus.js | 5 ++---
2 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/379d630d/lib/client/platform/cordova/2.0.0/spec/events.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/2.0.0/spec/events.js b/lib/client/platform/cordova/2.0.0/spec/events.js
index 5cf3159..b7be9ea 100644
--- a/lib/client/platform/cordova/2.0.0/spec/events.js
+++ b/lib/client/platform/cordova/2.0.0/spec/events.js
@@ -22,11 +22,10 @@ function _fires(name, data) {
return function () {
var win = ripple('emulatorBridge').window();
- if (!win.cordova) {
- throw "You must have cordova.js included in your projects, to be able to trigger events";
+ if (win && win.cordova) {
+ // Do nothing if we aren't emulating a valid Cordova application
+ win.cordova.fireDocumentEvent(name, data);
}
-
- win.cordova.fireDocumentEvent(name, data);
};
}
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/379d630d/lib/client/ui/plugins/batteryStatus.js
----------------------------------------------------------------------
diff --git a/lib/client/ui/plugins/batteryStatus.js b/lib/client/ui/plugins/batteryStatus.js
index 097b551..f543900 100644
--- a/lib/client/ui/plugins/batteryStatus.js
+++ b/lib/client/ui/plugins/batteryStatus.js
@@ -51,9 +51,8 @@ function _updateUI(status) {
function _fireBatteryEvent(status) {
var win = ripple('emulatorBridge').window();
- if (!win.cordova) {
- throw "You must have cordova.js included in your projects, to be able to trigger events";
- } else if (status) {
+ if (win && win.cordova) {
+ // Do nothing if we aren't emulating a valid Cordova application
win.cordova.fireWindowEvent("batterystatus", status);
var level = parseInt(status.level);