Browse Source

init.js commented

Herbert Vojčík 11 năm trước cách đây
mục cha
commit
191a17db23
1 tập tin đã thay đổi với 8 bổ sung0 xóa
  1. 8 0
      js/init.js

+ 8 - 0
js/init.js

@@ -11,8 +11,16 @@
     }
 
     if (inBrowser) {
+        // init is lengthy process done in JavaScript.
+        // setTimeout here postpones it, so DOM ready
+        // event can occur sooner, thus load process
+        // may appear optically faster.
         setTimeout(init, 0);
     } else {
+        // In certain configurations, setTimeout is not feasible.
+        // It is mainly for `amberc`-produced concatenated
+        // node.js programs. There, the actual "main" appears
+        // immediately after init, so it must happens synchronously.
         init();
     }
 })();