Improved Asset Loading check if script is currently loading
-
Good day!
With the “Improved Asset Loading” feature
some scripts are loaded not using the wp_enqueue_script function, like the swiper js
how does the loading of these scripts work? how can I check if elementor is trying to load this file?
I can check when it finishes loading by checking the “Swiper” in the js window object
but how can I check while it is still loading, or trying to load it?
The problem is the swiper js file would be loaded twice, since it is not using the wp_enqueue_script, it doesn’t know I already have the file loaded.
I am now trying to load the swiper js via javascript (creating a script element and appending to body)
I could add e setInteval that would wait for e few seconds until it attempts to load my own swiper js, but this might not be reliable as the load time of the elementor swiper js varies.
Sometimes just 1 sec, sometimes up to 3 sec. There might be a better way?
The topic ‘Improved Asset Loading check if script is currently loading’ is closed to new replies.