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

Add asynchronous support #15

Open
szmarci opened this issue Feb 15, 2017 · 2 comments
Open

Add asynchronous support #15

szmarci opened this issue Feb 15, 2017 · 2 comments

Comments

@szmarci
Copy link

szmarci commented Feb 15, 2017

Hi @crisfervil, great tool!

I'm using your package in an electron desktop app and so far it works great.
One thing I'm missing is to have callbacks to respond the events.
Like when I do a retrieveMultiple() call, I want to show an animation, and when the data is fetched I want to stop the animation. Right it just happens when it happens.

Do you think thats possible somehow?
Thanks!

@crisfervil
Copy link
Owner

Hey szmarci,

The main goal of DynamicsNode is keep things simple in order to make very easy to write code for simple tasks. Unfortunately simplicity and asynchronous doesn't seem to fit in the same sentence :(

That's being said, I received several requests to support async calls, so in order to keep improving the tool, I'll try to find a way to do it without sacrificing simplicity.

I was thinking in adding a retriveMultipleAsync method, that returns a Promise. What do you think about that? Do you think it will work for you?

I'll rename this issue and label it as a feature request, and I'll do my best to include it ASAP.

Thanks!

@crisfervil crisfervil changed the title Respond to events with callback functions Add Asynchronous support Feb 16, 2017
@crisfervil crisfervil changed the title Add Asynchronous support Add asynchronous support Feb 16, 2017
@szmarci
Copy link
Author

szmarci commented Feb 17, 2017

Hey @crisfervil,

Thanks for the feedback. The async version of retrieve, that would be awesome!

Another thing I thought of: error handling. Right now if something is wrong with the query, it just fails with a console message. I don't know how to catch that error message (particularly what went wrong). I could do a window.onerror, but that would just tell me something is wrong, not what is wrong.
Do you think the reject callback of the promise could return that error object, that is now in the console?

Thanks for your help.
Looking forward to the async version!

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

No branches or pull requests

2 participants