-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add removeAllListeners
method
#1288
Conversation
Preview published: add-listen |
Preview published: add-listen |
Preview published: add-listen |
Preview published: add-listen |
The code example could be reduced to: window.ethereum.on('_initialized', updateWalletAndAccounts);
window.ethereum.on('connect', updateWalletAndAccounts);
window.ethereum.on('accountsChanged', updateWallet);
window.ethereum.on('chainChanged', updateWalletAndAccounts);
window.ethereum.on('disconnect', disconnectWallet);
return () => {
window.ethereum.removeAllListener() This example is more efficient code that instead of setting multiple This will reduce the complexity of the example in a way that doesn't compromise the illustrated point. |
Preview published: add-listen |
Co-authored-by: Alexandra Tran Carrillo <12214231+alexandratran@users.noreply.github.com>
Preview published: add-listen |
Preview published: add-listen |
Preview published: add-listen |
Preview published: add-listen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once suggestions are addressed
Co-authored-by: Alexandra Tran Carrillo <12214231+alexandratran@users.noreply.github.com>
Preview published: add-listen |
1 similar comment
Preview published: add-listen |
Preview published: add-listen |
Preview published: add-listen |
Description
Adds
removeAllListeners
method and example to docsIssue(s) fixed
Fixes #563
Preview
https://docs.metamask.io/add-listen/wallet/reference/provider-api/#remove-listeners
Checklist
Complete this checklist before merging your PR: