Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 43A569DD3 for ; Fri, 20 Apr 2012 00:21:41 +0000 (UTC) Received: (qmail 57201 invoked by uid 500); 20 Apr 2012 00:21:41 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 57128 invoked by uid 500); 20 Apr 2012 00:21:41 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 56942 invoked by uid 99); 20 Apr 2012 00:21:40 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Apr 2012 00:21:40 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 709DCDA38; Fri, 20 Apr 2012 00:21:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anis@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [9/15] git commit: [CB-550] Fixed unregistering pause and resume events. Works now. Message-Id: <20120420002140.709DCDA38@tyr.zones.apache.org> Date: Fri, 20 Apr 2012 00:21:40 +0000 (UTC) [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 Authored: Thu Apr 19 16:33:28 2012 -0700 Committer: Anis Kadri 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) {