-
Notifications
You must be signed in to change notification settings - Fork 0
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
Freshbooks Sync calls need making asynchronous #1
Comments
I am not going to update the invoice and baseinvoice for now, because I don't use them. YMMV. |
An approach could to convert routines like:
Into something like:
And then do the same for the other methods. |
Further, I suppose - for non-node invocations - traditional JS, in sendRequest, I could call the callback immediately. From:
To:
|
I ended up converting:
Into:
Where HttpClient.send is aliased to nodeSend if running under Node:
And:
|
What's left to do now is convert all the other IO methods to use callbacks - question is - did I do this reasonably well? |
Node never waits for IO.
So this call to
node_modules/freshbooks-javascript-library/library/FreshBooks/Element.js-
will not wait and the return must be decoupled into a callback.
So, node_modules/freshbooks-javascript-library/library/FreshBooks/Element.js:
needs to be changed to accept a callback on the method signature and to pass that callback down to httpClient.send:
As well as affecting httpClient.send, it affects Element.js, BaseInvoice.js and Invoice.js:
grep -C4 -i -r sendRequest node_modules/freshbooks-javascript-library/library/FreshBooks/Element.js
The text was updated successfully, but these errors were encountered: