code: function onStatusChange (evt) {
      type = navigator.onLine ? Connection.UNKNOWN : Connection.NONE;
      // force async
      setTimeout(function () {
          cordova.fireDocumentEvent(evt.type);
      }, 0);
  }
docs: Subscribe to 'native' online/offline events