jasonkarns
4/30/2013 - 3:06 PM

Facebook's JS SDK doesn't support registering multiple 'ready' handlers. So here's an implementation inspired by Twitter's SDK. (uses unders

Facebook's JS SDK doesn't support registering multiple 'ready' handlers. So here's an implementation inspired by Twitter's SDK. (uses underscore)

window.fb = (b = { _e: [], ready: function(f){ b._e.push(f); } });

window.fbAsyncInit = function() {
  fb.ready = function(f){ f(); };
  _.invoke(fb._e, 'call');
};

fb.ready(function(){ console.info("facebook sdk loaded"); });