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 419EC9A33 for ; Tue, 29 May 2012 20:34:24 +0000 (UTC) Received: (qmail 7928 invoked by uid 500); 29 May 2012 20:34:23 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 7894 invoked by uid 500); 29 May 2012 20:34:23 -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 7867 invoked by uid 99); 29 May 2012 20:34:23 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2012 20:34:23 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 80013142859 for ; Tue, 29 May 2012 20:34:23 +0000 (UTC) Date: Tue, 29 May 2012 20:34:23 +0000 (UTC) From: "Drew Walters (JIRA)" To: callback-dev@incubator.apache.org Message-ID: <1996832096.12781.1338323663526.JavaMail.jiratomcat@issues-vm> In-Reply-To: <358370104.12776.1338323543025.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Updated] (CB-840) deviceready event listener not notified if previously fired MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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