I am trying to speed up the loading of DataTables.js. Currently the websites UI is available for almost 4 seconds before the DataTables' features appear. One idea I had was to use a JavasScript loader. I did some research and found little-loader.js. The examples do not mention how to use it to load files with dependencies. How can I use it to load such files? Here is my code so far:
<script src="https://unpkg.com/little-loader@VERSION/dist/little-loader.min.js"></script>
<script>
window._lload("http://example.com/jquery-min.js", function (err) {
// `err` is script load error.
if( err === '' ) {
window._lload("http://example.com/js/datatables-min.js", function (err) {
//Maybe load other scripts
} );
}
} );
</script>