-
-
Notifications
You must be signed in to change notification settings - Fork 134
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 Promise support #185
Comments
IMO, the advantages of using |
As stated before by @DoctorMcKay the reason hes not supporting this is because the node version hes based on is v4 which is LTS. Making a wrapper for the calls you need using bluebird is very straightforward and takes no more than a hour or two. p.s. Writing functional code will keep you away from callback hell, but either way you should never have to go more than a layer or two deep. You must be doing something really wrong to go 13 layers deep... If you need some help with improving the quality of your code you can check out this book: |
Since v4 is out of active support, I'm (slowly) starting to migrate my stuff to Node v6 (i.e. dropping support for 4). This will be a major module release when it does happen. |
Is there any progress Mr. McKay? I learned ES6 promises and now I can not stop using them 💃 |
Work has already started. See |
Nice! Is it complete already? Or can't be used in production for now. |
Good chance, native promise support in not coming stable anytime soon, @Baterka, for now, promisify on your own, there's only a few methods. |
+1, it would be great to support promises as in steam-user. |
Any updates on this? Looks like v3 has been on hold for quite some time. |
If a user wants to load user's inventory in a function, he/she has to do this:
Eventually, if you have a lot of callbacks, it can grow up to a mess, like in these screenshot:
If this library had a Promise support, you can do it this way (that's how I imagine it):
Or (that's the way I prefer to use it) even use
async/await
with it (I think it's awesome, though it's not officially supported by Node.JS/ECMA standard and I have to use babel to compile it):We don't even need to use custom libraries (like
q
,bluebird
etc.), because Node.JS handles Promises natively now.My suggestion is: every time a function with callback (e.g.
offer.getReceivedItems
) is called, check the last argument, and if it's not defined, then return a Promise wrapper, if it's defined, just call the callback directly.The text was updated successfully, but these errors were encountered: