Skip to content

Instantly share code, notes, and snippets.

@rdlabo
Created September 2, 2019 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdlabo/5359725aeb7ca5588632e69047b99fda to your computer and use it in GitHub Desktop.
Save rdlabo/5359725aeb7ca5588632e69047b99fda to your computer and use it in GitHub Desktop.
reload
let isAlert = false;
setTimeout(() => {
if (!isAlert) {
// Alertをだしてユーザが選択したらreload
}
}, 2000); <= Timeout時間
this.afAuth.auth.currentUser.getIdToken(false)
.then()
.finally(() => isAlert = true);
// なぜかうまくいかなかったPromise.race
return Promise.race([
this.afAuth.auth.currentUser.getIdToken(false),
new Promise((resolve, reject) => {
setTimeout(() => reject(), this.timeoutDefault);
}),
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment