BooStore.pro CMS Platform News
Updates on the BooStore.pro platform for creating websites and online stores

BooStore.pro improves script loading: moving away from $.getScript

BooStore.pro improves script loading: moving away from $.getScript

The BooStore.pro team has optimized JavaScript performance on the platform by replacing $.getScript with dynamic creation of <script> elements using plain JavaScript.







Previously, scripts were loaded like this:

Code: JavaScript
$(function(){
if ($(".hotengine-shop-products-add-count-spinner").length){
         if(typeof $hotengine_shop_product_count_spinner == "undefined"){
		        $.getScript("/templates/scripts/hotengine-script-shop-product-count-spinner.js?v33").fail(function(jqxhr, settings, exception) { console.error("Failed to load script: ", exception);
                });
		 }
} 
});

Now, a different approach is used:

Code: JavaScript
$(function(){
    if ($(".hotengine-shop-products-add-count-spinner").length){
        if (typeof $hotengine_shop_product_count_spinner == "undefined"){
            const s = document.createElement("script");
            s.async = true;
            s.src = "/templates/scripts/hotengine-script-shop-product-count-spinner.js?v34";
            s.onerror = (e) => { console.error(`Failed to load script: ${s.src}`, e); };
            document.head.appendChild(s);
        }
    }
});


Why this is recommended:

  • No jQuery required, fewer dependencies.
  • Control over duplicate loading: script is inserted only once.
  • Asynchronous loading improves performance without blocking the page.
  • Simple and predictable error handling via onerror.
  • Code is more modern and compatible with plain JavaScript.
Added HTML Widget with Tabs (fully HTML without JavaScript)
Quick price editing added to booking slots
Added the ability to specify an additional SMTP server for sending via the Database of e-mail addresses.