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

No way to unsubscribe from once #99

Closed
futpib opened this issue Jul 29, 2022 · 3 comments · Fixed by #100
Closed

No way to unsubscribe from once #99

futpib opened this issue Jul 29, 2022 · 3 comments · Fixed by #100

Comments

@futpib
Copy link
Contributor

futpib commented Jul 29, 2022

once returns a promise and nothing else, so if you do a once and it never gets emitted it's leaked forever.

@sindresorhus
Copy link
Owner

Any suggestions on how we could solve this?

One idea is to add a special symbol to the returned promise and add a .offOnce() method to Emittery that checks for the special symbol and unsubscribes.

@futpib
Copy link
Contributor Author

futpib commented Jul 29, 2022

Maybe extend the returned promise with an unsubscribe or off method?

@sindresorhus
Copy link
Owner

Yeah, that may be more discoverable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants