Skip to content

Instantly share code, notes, and snippets.

@ZeRRoCull
Last active September 10, 2016 06:37
Show Gist options
  • Save ZeRRoCull/88bb65f0b09368ec7dbd2fc48753d054 to your computer and use it in GitHub Desktop.
Save ZeRRoCull/88bb65f0b09368ec7dbd2fc48753d054 to your computer and use it in GitHub Desktop.
Оптимизированная загрузка JS-библиотек
<script>var scr = {"scripts":[
{"src" : "js/libs.min.js", "async" : false},
{"src" : "js/common.js", "async" : false}
]};!function(t,n,r){"use strict";var c=function(t){if("[object Array]"!==Object.prototype.toString.call(t))return!1;for(var r=0;r<t.length;r++){var c=n.createElement("script"),e=t[r];c.src=e.src,c.async=e.async,n.body.appendChild(c)}return!0};t.addEventListener?t.addEventListener("load",function(){c(r.scripts);},!1):t.attachEvent?t.attachEvent("onload",function(){c(r.scripts)}):t.onload=function(){c(r.scripts)}}(window,document,scr);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment