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

Support event emitters from PaymentsSDK and Resource #39

Merged
merged 4 commits into from
Jul 30, 2020

Conversation

perrin4869
Copy link
Collaborator

Closes #38

This works by using the newListener and removeListener events - whenever the Resource or PaymentsSDK gets an event handler, it is relayed to the underlying api object.
However, eventemitter3 doesn't support these built-in events, so it had to be replaced with a more straightforward node polyfill. The good thing here is that in node environments, we'll just keep using the regular node module. The bad news is that standard node typings are not as strict as the eventemitter3 typings - these do not support generics, so the events are not type safe anymore.

@coveralls
Copy link

coveralls commented Jul 29, 2020

Coverage Status

Coverage increased (+0.02%) to 96.41% when pulling 0d54a61 on feature/perrin4869/sdk-resources-ee into b08fe01 on master.

@phieronymus
Copy link
Collaborator

Nice trick 🙂 Would it be possible to add the event it can listen to in the Readme? As the type disappeared I am scared that finding what the logging is capable of will be harder to find.

@perrin4869
Copy link
Collaborator Author

Done!

@phieronymus
Copy link
Collaborator

Thanks a lot! Merging this 🙂

@phieronymus phieronymus merged commit 117783e into master Jul 30, 2020
@phieronymus phieronymus deleted the feature/perrin4869/sdk-resources-ee branch October 7, 2020 04:57
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.

Allow event listeners to be used on the SDK
3 participants