You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2012/04/20 02:21:40 UTC
[9/15] git commit: [CB-550] Fixed unregistering pause and resume
events. Works now.
[CB-550] Fixed unregistering pause and resume events. Works now.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/f59cf2d1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/f59cf2d1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/f59cf2d1
Branch: refs/heads/master
Commit: f59cf2d1f319e6441ca1d0f0baa140242186b22d
Parents: 71214ef
Author: Fil Maj <ma...@gmail.com>
Authored: Thu Apr 19 16:33:28 2012 -0700
Committer: Anis Kadri <an...@gmail.com>
Committed: Thu Apr 19 17:21:04 2012 -0700
----------------------------------------------------------------------
lib/cordova.js | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f59cf2d1/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova.js b/lib/cordova.js
index e9cd5da..c7917e6 100644
--- a/lib/cordova.js
+++ b/lib/cordova.js
@@ -54,13 +54,18 @@ window.addEventListener = function(evt, handler, capture) {
};
document.removeEventListener = function(evt, handler, capture) {
- var e = evt.toLowerCase();
- // If unsubcribing from an event that is handled by a plugin
- if (typeof documentEventHandlers[e] != "undefined") {
- documentEventHandlers[e].unsubscribe(handler);
- } else {
- m_document_removeEventListener.call(document, evt, handler, capture);
- }
+ var e = evt.toLowerCase();
+ // Check for pause/resume events first.
+ if (e == 'resume') {
+ channel.onResume.unsubscribe(handler);
+ } else if (e == 'pause') {
+ channel.onPause.unsubscribe(handler);
+ // If unsubcribing from an event that is handled by a plugin
+ } else if (typeof documentEventHandlers[e] != "undefined") {
+ documentEventHandlers[e].unsubscribe(handler);
+ } else {
+ m_document_removeEventListener.call(document, evt, handler, capture);
+ }
};
window.removeEventListener = function(evt, handler, capture) {