PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.6.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.6.0
4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 3.8.0 All 110 releases
wp-optimize / js / loadAsync.js

loadAsync.js in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.6.0, at js/loadAsync.js

23 lines 670 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * This function will work cross-browser for loading scripts asynchronously
3 */
4 function loadAsync(src, callback) {
5 var scriptTag,
6 ready = false;
7
8 scriptTag = document.createElement('script');
9 scriptTag.type = 'text/javascript';
10 scriptTag.src = src;
11 scriptTag.onreadystatechange = function() {
12 // console.log( this.readyState ); //uncomment this line to see which ready states are called.
13 if (!ready
14 && (!this.readyState || this.readyState == 'complete')
15 ) {
16 ready = true;
17 typeof callback === 'function' && callback();
18 }
19 };
20 scriptTag.onload = scriptTag.onreadystatechange
21
22 document.getElementsByTagName("head")[0].appendChild(scriptTag)
23 }