Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-840

deviceready event listener not notified if previously fired

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.0
    • 1.8.0
    • cordova-js
    • None

    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':

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

      Attachments

        Activity

          People

            deedubbu Drew Walters
            deedubbu Drew Walters
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: