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

Make fuels event listeners accept async callbacks #3582

Open
nedsalk opened this issue Jan 13, 2025 · 2 comments
Open

Make fuels event listeners accept async callbacks #3582

nedsalk opened this issue Jan 13, 2025 · 2 comments
Labels
feat Issue is a feature

Comments

@nedsalk
Copy link
Contributor

nedsalk commented Jan 13, 2025

Currently, the FuelsEventListener type returns void. We should update the return type to Promise<void> | void because being able to pass in async callbacks comes in quite handy sometimes. Besides this type, we should update the onFailure listener as well.

This would entail always awaiting the listener callbacks. As of now, sometimes we do it, sometimes we don't.

@nedsalk nedsalk added the feat Issue is a feature label Jan 13, 2025
@nedsalk
Copy link
Contributor Author

nedsalk commented Jan 13, 2025

@arboleya I don't know if I understood you correctly in #3504 (comment), so I'll just assume that you meant making it always async so that the return type is Promise<void> only. This would be a breaking change - people's compilations/linters would fail because their synchronous callbacks returning void can't be assigned to the new type returning Promise<void>, hence why I described the return type to be Promise<void> | void in the issue.

@arboleya
Copy link
Member

You can use Promise<void> | void, no problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature
Projects
None yet
Development

No branches or pull requests

2 participants