Closed shaunc869 closed 6 years ago
As a temporary workaround you can use promisify
to add "Async" versions of all the functions:
// core/Quickbooks.js
import QuickBooks from 'node-quickbooks';
import Promise from 'bluebird';
QuickBooks.setOauthVersion('2.0');
// Original functions must follow the `(err, value) =>` callback style
Promise.promisifyAll(QuickBooks.prototype);
// ...
export default QuickBooks;
// other/file.js
import Quickbooks from 'core/quickbooks';
const qb = new Quickbooks(/* opts */)
qb.getCompanyInfo(id, cb) // normal callback version
qb.getCompanyInfoAsync(id) // => Promise
I'm using bluebird's promisifyAll to add the additional functions to the prototype object. You could also use node 8's built in util.promisify
to accomplish the same manually.
@drewjs Out of curiosity how could I use util.promisify? I'm having a hard time figuring this one out.
Why is this closed? This would be an extremely useful feature
@drewjs Out of curiosity how could I use util.promisify? I'm having a hard time figuring this one out.
Did you ever get the syntax for this? I'm struggling with this today 3 years later.
Thanks either way.
This is an important issue and wouldn't be hard to implement just using bluebird on this package thoughts?
This is feature request, since Node 8 we can use the await/async pattern and it would be great if this library could be updated to return promises accordingly since pretty much everything is going this way already. Thanks for the consideration.