Thuzi / facebook-node-sdk

Modeled from the (Facebook Javascript SDK), now with the facebook-node-sdk you can now easily write the same code and share between your server (nodejs) and the client (Facebook Javascript SDK).
Other
737 stars 250 forks source link

Promises suport #94

Closed mateusvahl closed 2 years ago

mateusvahl commented 9 years ago

Since promises will be native in ES6 and currently methods do not return to anything important, we could return a Promise using any polyfill.

Opinions?

cmwelsh commented 9 years ago

Most Promise libraries will handle this for you. See how I use Bluebird.promisifyAll here:

https://github.com/cmwelsh/facebook-friend-list/blob/master/src/lib/facebook-api.js#L6

mateusvahl commented 9 years ago

Yhep, but maybe can be a good idea as default, we don't need remove callbacks.

hungtuchen commented 9 years ago

Actually I made an utility wrapper around, You can check here. https://github.com/transedward/fb_promise

dantman commented 8 years ago

fb@^2.0.0-alpha1 (npm install fb@next) now supports Promises natively.

When FB.api is called without a callback a Promise is returned instead. The promise implementation used can be controlled using either any-promise's registration or by setting the Promise option.