Skip to content

Instantly share code, notes, and snippets.

@ylv-io
Last active January 14, 2019 12:15
Show Gist options
  • Save ylv-io/fae2fedad126eb8dfd2bc2989684197d to your computer and use it in GitHub Desktop.
Save ylv-io/fae2fedad126eb8dfd2bc2989684197d to your computer and use it in GitHub Desktop.
let account = getAccount();
let accountInterval = setInterval(() => {
if (getAccount() !== account) {
account = getAccount();
if (account === undefined) {
// if account changed to undefined, that means metamask is now locked
updateEverything();
} else {
// if account is not undefined, that means metamask is now unlocked
updateEverything();
}
}
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment