Created
October 27, 2011 16:40
-
-
Save 0xSventek/1320083 to your computer and use it in GitHub Desktop.
Javascript SDK example
This file contains hidden or 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
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