<aside> <img src="/icons/code_gray.svg" alt="/icons/code_gray.svg" width="40px" /> Including JavaScript in the middle of an HTML page can cause the browser to pause parsing the rest of the HTML until the script is downloaded and executed. For improved performance, embed components can be placed outside of the section component as the last element on the page.
</aside>
<script>
(function(global){global.pageFunctions=global.pageFunctions||{executed:{},functions:{},addFunction:function(id,fn){if(!this.functions[id])this.functions[id]=fn},executeFunctions:function(){if(this.added)return;this.added=true;for(const id in this.functions){if(!this.executed[id]){try{this.functions[id]();this.executed[id]=true}catch(e){console.error(`Error executing function ${id}:`,e)}}}}}})(window);
</script>
<script>
pageFunctions.executeFunctions();
</script>
<script>
pageFunctions.addFunction('yourFunctionName', function() {
// your code
});
</script>