Skip to content
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

Update onboarding-library.md #504

Merged
merged 2 commits into from Jul 4, 2022
Merged

Update onboarding-library.md #504

merged 2 commits into from Jul 4, 2022

Conversation

Nahee-Park
Copy link
Contributor

Replace ethereum.off with ethereum.removeListener
MetaMask/metamask-extension#10873 (comment)

@Nahee-Park Nahee-Park requested review from a team and BboyAkers as code owners June 22, 2022 08:43
@sigridjineth
Copy link

sigridjineth commented Jun 22, 2022

Great work from @Nahee-Park 👍 The docs seem to be required more attention from developers to have up-to-date content. The issue was once claimed from the following issue, but not reflected correctly in the documentation.

I hope for ppl to avoid any possible holes staggering into the issue. In addition, it was once suggested from the EIP-1193 protocol suggestion link.

The code below has its reference.

provider.on("accountsChanged", handleAccountsChanged)

function handleAccountsChanged() {
  // do something
}

// When leaving the page (Vue 3 - Composition API)
onUnmounted(() => {
  if (provider.removeListener) {
    provider.removeListener("accountsChanged", handleAccountsChanged)
  }
})

Copy link
Collaborator

@BboyAkers BboyAkers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for catching this 🙂

@BboyAkers BboyAkers merged commit 06dfcfd into MetaMask:main Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants