Created
April 21, 2012 17:09
-
-
Save dcabines/2438490 to your computer and use it in GitHub Desktop.
This is the facebook interface for my app.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the Facebook component of my app. | |
This is the only component that is allowed to talk to the Facebook API directly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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