Created
February 27, 2017 16:16
-
-
Save WunGCQ/ceee119f22452970db0ec2c3d90fab65 to your computer and use it in GitHub Desktop.
javascript check css in html document loaded
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function check(){ | |
setTimeout(()=>( | |
var len = 0, arr = [],count = 0; | |
arr = Array.prototype.slice.call(document.head.children).filter(el=>((el.tagName == 'LINK'&& el.href) || (el.tagName == 'SCRIPT' && el.src))),len = arr.length,arr).forEach(e=> | |
e.addEventListener('load',()=>console.log(`finished ${++count} of ${len}`))),0); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
<script> | |
setTimeout(()=>(window.len = 0, arr = [],count = 0,arr = Array.prototype.slice.call(document.head.children).filter(el=>((el.tagName == 'LINK'&& el.href) || (el.tagName == 'SCRIPT' && el.src))),len = arr.length,arr).forEach(e=> | |
e.addEventListener('load',()=>console.log(`finished ${++count} of ${len}`))),0); | |
</script> | |
<link rel="stylesheet" href="./test1.css"> | |
<link rel="stylesheet" href="./test2.css"> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment