Skip to content

Instantly share code, notes, and snippets.

@davidcornu
Created August 23, 2013 16:15
Show Gist options
  • Save davidcornu/6321150 to your computer and use it in GitHub Desktop.
Save davidcornu/6321150 to your computer and use it in GitHub Desktop.
(function(){
var fontsLoaded = false;
var listeners = [];
function fontsDidLoad(){
for (var i = 0; i < listeners.length; i += 1) { setTimeout(listeners[i], 0); }
fontsLoaded = true;
}
window.onFontsLoaded = function(callback){
if (fontsLoaded) return setTimeout(callback, 0);
listeners.push(callback);
};
Typekit.load({ active: fontsDidLoad });
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment