Small library for importing scripts into html document (using XHR).
For internet explorer 11 or higher.
This library must be put in the head tag of html document.
<html>
<head>
<title> My page - Mi página </title>
<script src="Import.js"></script>
<script>
const options = {
mode: 'sync', //optional for "defer" mode
load: function(){}, //optional
error: function(){} //optional
}
//Import sync (block parser). readyState = loading in this case
Import.JS('src/script-1', options);
Import.CSS('src/style-1', options);
//Import async. readyState = interactive || complete
options.mode = 'async';
Import.JS('src/script-2', options);
Import.CSS('src/style-2', options);
//Import defer. readyState = interactive in this case
options.mode = 'defer' || null;
Import.JS('src/script-3', options);
Import.JS('src/script-4');
Import.CSS('src/style-3', options);
Import.CSS('src/style-3');
</script>
</head>
<body>
<!-- page content - contenido de la página -->
</body>
</html>
Follow the example above.
- Emanuel Rojas Vásquez - Initial work - erovas
This project is licensed under the MIT License - see the LICENSE file for details.