Socket
Socket
Sign inDemoInstall

promise-facebook

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    promise-facebook

The facebook SDK but with a promise api.


Version published
Weekly downloads
4
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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()

See FB.getLoginStatus()

parameters:

force: Force reloading the login status (default false).

returns:

promise for the logout response

Usage:

var facebook = require("./facebook")(<YOUR_APP_ID>);

facebook
.then(function (facebook) {
    return facebook.login({scope: 'user_photos'});
})
.then(function () {
    return facebook.api('/me/albums', 'get');
})
.then(function (albums) {
     return facebook.api('/'+albums[0].id+'/photos', 'get');
})
.then(function (results) {
    console.log("results", results);
})
.done();

FAQs

Last updated on 16 May 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc