I am currently dealing with an external javascript file that I only want to be included on a specific component, so the approach I'm taking involves dynamically loading it. I came across this answer that explains exactly how to achieve this.
The problem arises because the javascript file I'm working with executes some tasks when the window is fully loaded:
$(window).on('load', function() {
//Some logic
});
Considering that I am loading this script dynamically for a particular component, the logic inside it never runs as the load event has already fired before the script gets loaded. Is there a way for me to trigger this logic after successfully loading the script?