This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
introduce native promise support incl. documentation & types #137
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added native promise support for consumers of this module.
Already updated
README.md
to include examples and some other stuff.Also did some very basic tests on my own in the node repl (although I have not included any written tests in this PR)... this is a rather simple update and everything appears to check out.
Requires recent version of Node due to usage of the package.json "exports" field (which is itself backwards-compatible since I left "main" in there).
The promise support is implemented via a wrapper in its own separate file (./src/promises.js), so this should really not be a breaking change. The original api was left untouched.
The only thing that seems unclear to me is error-handling when it comes to this new promise version of the api, and which errors are catchable and which aren't. At the very least, I am fairly confident that any thrown errors will not go unnoticed. I did see some errors being thrown, instead of returned via callback, in async callback contexts in some of the login/init methods of this module. I'm pretty sure those cannot be caught no matter if a consumer is using this new promise api nor the original callback api. Other than that, Promises + Errors = Confusion (at least for me), but it still seems like everything should be just fine.
Should be all good to go!