Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: None  |  size: 1.16 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Facebook apprequest not being sent to facebook users
  2. exports = fm.namespace(this,'bla','facebook')
  3.  
  4. exports['init'] = function(){
  5.   window.fbAsyncInit = function() {
  6.     if (undefined !=RAILS_ENV['facebook_app_id'])
  7.     {FB.init({
  8.                appId      : RAILS_ENV['facebook_app_id'], // App ID
  9.       status     : true, // check login status
  10.       cookie     : true, // enable cookies to allow the server to access the session
  11.       oauth      : true, // enable OAuth 2.0
  12.       xfbml      : true  // parse XFBML
  13.              });}
  14.   };
  15.  
  16.   // Load the SDK Asynchronously
  17.   (function(d){
  18.     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
  19.     js = d.createElement('script'); js.id = id; js.async = true;
  20.     js.src = "//connect.facebook.net/en_US/all.js";
  21.     d.getElementsByTagName('head')[0].appendChild(js);
  22.   }(document));
  23. }
  24. exports['sendRequestToOneRecipient']= function (uid) {
  25.   FB.ui({method: 'apprequests',
  26.     message: "bla bla",
  27.     to: uid
  28.   }, requestCallback);
  29.  
  30.   function requestCallback(response) {
  31.     if (response && response.to) {
  32.       console.log("Message was sended");
  33.     } else {
  34.       console.log("Message was not sended.");
  35.     }
  36.   }
  37. }