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

Reply via email to