UI pending while JavaScript is executing
UI long pending while Heavy Weight JavaScript is executing
function fun1() {
console.log("fun1");
setTimeout(fun2, 0);
console.log("fun1-2");
fun3();
}
function fun2() {
console.log("fun2");
}
function fun3() {
console.log("fun3");
}
fun1();
Expect Result: fun1, fun2, fun1-2, fun3 ?
Possible to WebWorker.
Loading Route...
// index.html
// worker.js
// importScripts( ‘library1.js’, ‘library2.js’);
onmessage = function ( event ) {
// TODO:: Bussiness Logic
postMessage( data );
}
// index.html
// sharedWorker.js
var globalConnections = 0;
onconnect = function ( event ) {
var port = event.ports[0];
globalConnections++;
port.onmessage = function ( event ) {
port. postMessage( globalConnections );
// port.close();
}
}