Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Loading Javascript Libraries

Instead of using the following.

Code Block
languagexml
linenumberstrue
<script src="#appResource.someJSLibrary.js#">

<script>
	$(function(){
 		//continue with usual code execution 
	});
</script>


Please use.

Code Block
languagexml
linenumberstrue
<script>
    loadJSCount = 0; loadJSCountCompleted = 0;
    function loadJS(FILE_URL, async = true) {
      loadJSCount += 1;
      let scriptEle = document.createElement("script");
    
      scriptEle.setAttribute("src", FILE_URL);
      scriptEle.setAttribute("type", "text/javascript");
      scriptEle.setAttribute("async", async);
    
      document.body.appendChild(scriptEle);
    
      // success event 
      scriptEle.addEventListener("load", () => {
        console.log("File loaded");
        loadJSCountProcessed+= 1;
        if(loadJSCount == loadJSCountProcessed){
            windowReady();
        }
      });
       // error event
      scriptEle.addEventListener("error", (ev) => {
        console.log("Error on loading file", ev);
        loadJSCountProcessed+= 1;
        if(loadJSCount == loadJSCountProcessed){
            windowReady();
        }
      });
    }
    
    loadJS("#appResource.someJSLibrary.js#", true);
    
	//this acts as the replacement for windows.ready
    function windowReady(){
		//continue with usual code execution
	}


Custom Links and Buttons

If you have any custom html with <a> or <button> or <input> with button html tag, the AJAX Based DX 8 Themes would bind click event to intercept them, this is part of Single Page Application (SPA) treatment.

...