Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
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;
})
}