Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 88538D749 for ; Tue, 16 Oct 2012 21:13:04 +0000 (UTC) Received: (qmail 43002 invoked by uid 500); 16 Oct 2012 21:13:04 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 42946 invoked by uid 500); 16 Oct 2012 21:13:04 -0000 Mailing-List: contact callback-dev-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-dev@incubator.apache.org Received: (qmail 42822 invoked by uid 99); 16 Oct 2012 21:13:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Oct 2012 21:13:04 +0000 Date: Tue, 16 Oct 2012 21:13:03 +0000 (UTC) From: "Dmitry Zemnitskiy (JIRA)" To: callback-dev@incubator.apache.org Message-ID: <2060660707.53782.1350421984034.JavaMail.jiratomcat@arcas> Subject: [jira] [Created] (CB-1665) 'pause' and 'resume' events are fired immediately when added by document.addEventListener if they were fired once before MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Dmitry Zemnitskiy created CB-1665: ------------------------------------- Summary: 'pause' and 'resume' events are fired immediately when added by document.addEventListener if they were fired once before Key: CB-1665 URL: https://issues.apache.org/jira/browse/CB-1665 Project: Apache Cordova Issue Type: Bug Components: Android Affects Versions: 2.0.0 Reporter: Dmitry Zemnitskiy Assignee: Joe Bowser Priority: Minor I use cordova together with jquery mobile. In my app I install pause/resume event handlers just for one page (with canvas) on 'pageshow' and uninstall them on 'pagehide', so this can happen multiple times during application lifecycle. I noticed, that after pause/resume was fired at least once, next time I add event handlers they are fired immediately. Below is stack trace I made, you can notice that problematic line is in cordova-2.0.0.js line 564 (Channel.subscribe) The problem is that 'fired' flag is set in Channel.fire and never reset back, which is probably ok for deviceready event but not appropriate for pause/resume events which can happen multiple times. 10-16 23:36:04.901: D/CordovaLog(22015): at stopAccelerometerWatch (file:///android_asset/www/scripts/app.js:128:4) 10-16 23:36:04.901: D/CordovaLog(22015): at [object Object].onPause (file:///android_asset/www/scripts/app.js:85:3) 10-16 23:36:04.901: D/CordovaLog(22015): at [object Object].subscribe (file:///android_asset/www/cordova-2.0.0.js:564:26) 10-16 23:36:04.901: D/CordovaLog(22015): at HTMLDocument.addEventListener (file:///android_asset/www/cordova-2.0.0.js:105:38) 10-16 23:36:04.901: D/CordovaLog(22015): at initGame (file:///android_asset/www/scripts/app.js:43:12) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira