Skip to content

Instantly share code, notes, and snippets.

@jasonkarns
Last active December 16, 2015 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonkarns/5489335 to your computer and use it in GitHub Desktop.
Save jasonkarns/5489335 to your computer and use it in GitHub Desktop.
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"); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment