A package that wraps the Facebook javascript api to provide promises rather than callbacks.
Use the standard Facebook SDK on the browser and facebook-node-sdk
in node.js.
So far it works in the browser with the mr package loader from MontageJS.
Reference
require("promise-facebook")
The main module returns a function that accept the Facebook application id as an argument and returns a promise for the
FB object.
At the moment only api
, ui
, login
, logout
, and getLoginStatus
methods return promises.
.api()
See FB.api()
parameters:
path
, method
, params
returns:
promise for the response's data
.ui()
See FB.ui()
parameters:
params
returns:
promise for the dialog's response data
.login()
See FB.login()
parameters:
params
returns:
promise for the facebook object in a logged in state
.logout()
See FB.logout()
parameters:
none
returns:
promise for the facebook object in a logged out state
.getLoginStatus()
parameters:
force
: Force reloading the login status (default false).
returns:
promise for the logout response
Usage:
var facebook = <YOUR_APP_ID>; facebook;