-
-
Save alpenzoo/3d65b7b0a4966163662375abb8b57075 to your computer and use it in GitHub Desktop.
js
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
// http://learn.javascript.ru/external-script | |
function addScript(src){ | |
var script = document.createElement('script'); | |
script.src = src; | |
script.async = false; // чтобы гарантировать порядок | |
document.head.appendChild(script); | |
} | |
addScript('1.js'); // загружаться эти скрипты начнут сразу | |
addScript('2.js'); // выполнятся, как только загрузятся | |
addScript('3.js'); // но, гарантированно, в порядке 1 -> 2 -> 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment