Skip to content

Instantly share code, notes, and snippets.

@mjschranz
Created May 16, 2012 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mjschranz/2714317 to your computer and use it in GitHub Desktop.
Save mjschranz/2714317 to your computer and use it in GitHub Desktop.
Something
css: function( url, exclude, callback, checkFn ){
var scriptElement;
checkFn = checkFn || function(){
return !!scriptElement;
};
url = fixUrl( url );
if( !checkFn() ){
scriptElement = document.createElement( "link" );
scriptElement.rel = "stylesheet";
scriptElement.href = url;
//scriptElement.onload = callback;
document.head.appendChild( scriptElement );
}
var interval = setInterval(function(){
if( checkFn() ){
clearInterval( interval );
if( callback ){
callback();
}
}
}, CSS_POLL_INTERVAL );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment