incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [9/15] git commit: [CB-550] Fixed unregistering pause and resume events. Works now.
Date Fri, 20 Apr 2012 00:21:40 GMT
[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 <maj.fil@gmail.com>
Authored: Thu Apr 19 16:33:28 2012 -0700
Committer: Anis Kadri <anis.kadri@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) {


Mime
View raw message