0

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>
ermSO
  • 325
  • 1
  • 2
  • 12
  • How are you populating the datatable? I'm fairly confident that the loading issue could be solved without resorting to another plugin. – markpsmith Oct 26 '17 at 15:41
  • I am using an already constructed html table. No data is loaded. – ermSO Oct 26 '17 at 21:11
  • i believe you have to use json data instead of constructing it in html, it should be able to load faster – juntapao Oct 27 '17 at 01:44
  • load faster for development or for deployment? If for local development just require locally, for deployment, make sure you follow best practices :) https://betterexplained.com/articles/speed-up-your-javascript-load-time/ you could try caching it in local storage https://stackoverflow.com/questions/2746075/whats-faster-for-including-scripts-using-cdn-google-or-storing-them-locally – Evil Dr. PorkChop Nov 15 '17 at 19:54

0 Answers0