Skip to content

Instantly share code, notes, and snippets.

@dcabines
Created April 21, 2012 17:09
Show Gist options
  • Save dcabines/2438490 to your computer and use it in GitHub Desktop.
Save dcabines/2438490 to your computer and use it in GitHub Desktop.
This is the facebook interface for my app.
This is the Facebook component of my app.
This is the only component that is allowed to talk to the Facebook API directly.
define(['backbone', 'http://' + 'connect.facebook.net/en_US/all.js'], function (backbone) {
var facebook = backbone.Model.extend({
initialize: function () {
FB.init({
appId: this.get('appID'),
status: true,
cookie: true,
xfbml: true,
oauth: true
});
},
status: function (callback) {
FB.getLoginStatus(function (response) { callback(response); });
},
login: function (callback) {
FB.login(function (response) { callback(response); });
},
logout: function () {
FB.logout();
},
info: function (callback, id) {
FB.api('/' + (id || 'me'), function (response) { callback(response); });
}
});
var fb = new facebook({ appID: '359670380741025' });
return fb;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment