2
0

init.js 929 B

1234567891011121314151617181920212223242526
  1. (function (smalltalk,nil,_st) {
  2. var inBrowser = typeof amber !== "undefined" && typeof amber.load === "function";
  3. function init() {
  4. smalltalk.initialize();
  5. /* Similar to jQuery(document).ready() */
  6. if (inBrowser && amber.smalltalkReady) {
  7. amber.smalltalkReady(smalltalk,nil,_st);
  8. }
  9. }
  10. if (inBrowser) {
  11. // init is lengthy process done in JavaScript.
  12. // setTimeout here postpones it, so DOM ready
  13. // event can occur sooner, thus load process
  14. // may appear optically faster.
  15. setTimeout(init, 0);
  16. } else {
  17. // In certain configurations, setTimeout is not feasible.
  18. // It is mainly for `amberc`-produced concatenated
  19. // node.js programs. There, the actual "main" appears
  20. // immediately after init, so it must happens synchronously.
  21. init();
  22. }
  23. })(global_smalltalk,global_nil,global__st);