incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Drew Walters (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CB-840) deviceready event listener not notified if previously fired
Date Tue, 29 May 2012 20:34:23 GMT

     [ https://issues.apache.org/jira/browse/CB-840?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Drew Walters updated CB-840:
----------------------------

    Description: 
The fix for [CB-683] has broken previous behavior of the 'deviceready' event. Prior to CB-683,
registering an event listener for the 'deviceready' event after the event had already fired
would result in the specified handler immediately being fired.

The difference is due to channel.subscribe instead of channel.subscribeOnce being used. A
simple fix is to add back the invocation of subscribeOnce if the event is 'deviceready':

{code:javascript}
if (typeof documentEventHandlers[e] != 'undefined') {
    if (evt === 'deviceready') {
        documentEventHandlers[e].subscribeOnce(handler);
    } else {
        documentEventHandlers[e].subscribe(handler);
    }
} else {
{code}

  was:
The fix for [CB-683] has broken previous behavior of the 'deviceready' event. Prior to CB-683,
registering an event listener for the 'deviceready' event after the event had already fired
would result in the specified handler immediately being fired.

The difference is due to channel.subscribe instead of channel.subscribeOnce being used. A
simple fix is to add back the invocation of subscribeOnce if the event is 'deviceready':

    if (typeof documentEventHandlers[e] != 'undefined') {
        if (evt === 'deviceready') {
            documentEventHandlers[e].subscribeOnce(handler);
        } else {
            documentEventHandlers[e].subscribe(handler);
        }
    } else {

    
> deviceready event listener not notified if previously fired
> -----------------------------------------------------------
>
>                 Key: CB-840
>                 URL: https://issues.apache.org/jira/browse/CB-840
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.8.0
>            Reporter: Drew Walters
>            Assignee: Drew Walters
>             Fix For: 1.8.0
>
>
> The fix for [CB-683] has broken previous behavior of the 'deviceready' event. Prior to
CB-683, registering an event listener for the 'deviceready' event after the event had already
fired would result in the specified handler immediately being fired.
> The difference is due to channel.subscribe instead of channel.subscribeOnce being used.
A simple fix is to add back the invocation of subscribeOnce if the event is 'deviceready':
> {code:javascript}
> if (typeof documentEventHandlers[e] != 'undefined') {
>     if (evt === 'deviceready') {
>         documentEventHandlers[e].subscribeOnce(handler);
>     } else {
>         documentEventHandlers[e].subscribe(handler);
>     }
> } else {
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message