Skip to content

Instantly share code, notes, and snippets.

@0xSventek
Created October 27, 2011 16:40
Show Gist options
  • Save 0xSventek/1320083 to your computer and use it in GitHub Desktop.
Save 0xSventek/1320083 to your computer and use it in GitHub Desktop.
Javascript SDK example
var facebook_tools = new function() {
this.init = function () {
if (FB.getSession() == null) {
this.login();
} else {
facebook_session = FB.getSession();
}
return this;
};
this.login = function () {
FB.login(function(response) {
if (response.session) {
// console.log(" --------- LOGGED INTO FB --------- ");
return true;
} else {
// console.log(" --------- LOGIN FAILED --------- ");
return false;
}
}, {perms:'publish_stream'});
};
this.logout = function () {
FB.logout(function() {return false});
};
this.invite_a_friend = function (canvas_url) {
FB.ui({
method: 'send',
name: 'NFL Performance Challenge',
link: canvas_url,
description: "Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
picture: 'http://i.imgur.com/luTGA.png'
});
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment