-
Notifications
You must be signed in to change notification settings - Fork 10
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
Connect all Promise chains #8
base: master
Are you sure you want to change the base?
Conversation
I really like your library, thank you for it! However, the promise chains are broken in your code, which should be corrected. By chaining them all up, code depending on this module will be more reliable and also able to determine the status of actions. At the moment there is no way to determine whether initialization worked. By making a Promise out of the init method and adding it to the export object (API change... I know! but would be really added value!) a module depending on your code will already during initialization know whether everything is fine.
Hi @dominicbosch ! |
Dear Mark, I'm glad to hear that you are open to PR's and suggestions! I am currently using your library in a project with my dad where we are running an autonomously driving RC car. He just quickly tested what I proposed and it seems to work very good. But since the changes are on a quite low level, we would have to do a more extensive testing once we sit together again within the next week. The reason why I took such a close look at your library was because with the latest NodeJS version your code produces deprecation messages about unhandled Promises which will in the future cause the whole NodeJS procees to terminate!
This means that failing promises are not having a |
sorry my laptop decided to click on close... I am reopening this because it was not meant to be closed... |
On another note: These commands could actually be executed "concurrently" (I know there is no parallelism in NodeJS), and I guess on a hardware level it is "quite" sure that they are executed in the order they should.:
However, since you made the effort to wrap the
The callback within the
|
All functions return Promises + New `init` function
Hi @dominicbosch very busy week ,sorry I have not yet responded earlier! I will reply in depth to your posts later tonight ! |
I really like your library, thank you for it!
However, the promise chains are broken in your code, which should be corrected. By chaining them all up, code depending on this module will be more reliable and also able to determine the status of actions.
At the moment there is no way to determine whether initialization worked. By making a Promise out of the init method and adding it to the export object (API change... I know! but would be really added value!) a module depending on your code will already during initialization know whether everything is fine.
An API addition will also required, which outlines the new
.init()
method which returns a promise that allows to determine correct or false initialization.