title: How can I check if cordova is ready if the deviceready event has already fired?
body: <p>In the example app cordova provides through <code>cordova create ...</code>, the following code listens to the <code>deviceready</code> event:</p>
  
  <pre><code>bindEvents: function() {
      document.addEventListener('deviceready', this.onDeviceReady, false);
  },
  </code></pre>
  
  <p>This is nice, but what happens when the event is fired before I've had time to listen for it? As an example, replace the code from the example app (above) with the following:</p>
  
  <pre><code>bindEvents: function() {
      setTimeout(function () {
          document.addEventListener('deviceready', this.onDeviceReady, false);
      }, 2000)
  },
  </code></pre>
  
  <p>In this example, this.onDeviceReady is never called. Would there not be a better, more reliable way to check if cordova is ready? Something like this:</p>
  
  <pre><code>bindEvents: function() {
      setTimeout(function () {
          if (window.cordovaIsReady) {
              this.onDeviceReady()
          } else {
              document.addEventListener('deviceready', this.onDeviceReady, false);
          }
      }, 2000)
  },
  </code></pre>