How to use @wora/detect-network - 2 common examples

To help you get started, we’ve selected a few @wora/detect-network examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github morrys / react-relay-offline / src / runtime / RelayModernEnvironment.ts View on Github external
public restore(): Promise {
    if (this._isRestored) {
      return Promise.resolve(true);
    }
    NetInfo.isConnected.addEventListener('connectionChange', isConnected => {
      this._isOnline = isConnected;
      if(isConnected && !this._manualExecution) {
        this._storeOffline.execute();
      }
    });
    ;
    return Promise.all([NetInfo.isConnected.fetch(), this._storeOffline.restore(),
      ((this as any)._store as Store).restore(this),
    ]).then(result => {
      const isConnected = result[0];
      this._isOnline = isConnected;
      if(isConnected && !this._manualExecution) {
        this._storeOffline.execute();
      }
      this._isRestored = true;
      return true;
github morrys / react-relay-offline / src / runtime / RelayModernEnvironment.ts View on Github external
public restore(): Promise {
    if (this._isRestored) {
      return Promise.resolve(true);
    }
    NetInfo.isConnected.addEventListener('connectionChange', isConnected => {
      this._isOnline = isConnected;
      if(isConnected && !this._manualExecution) {
        this._storeOffline.execute();
      }
    });
    ;
    return Promise.all([NetInfo.isConnected.fetch(), this._storeOffline.restore(),
      ((this as any)._store as Store).restore(this),
    ]).then(result => {
      const isConnected = result[0];
      this._isOnline = isConnected;
      if(isConnected && !this._manualExecution) {
        this._storeOffline.execute();
      }
      this._isRestored = true;
      return true;
    }).catch(error => {
      this._isRestored = false;
      throw error;
    })
  }

@wora/detect-network

@wora Detect Network

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular @wora/detect-network functions