boot.js 784 B

123456789101112131415161718192021222324252627282930313233
  1. ;(function(deps, ice){
  2. var %REQUIRE%;
  3. var loader = require('glagol')
  4. , app = window.Glagol = loader(ice, { formats: %FORMATS% });
  5. Glagol.events = loader.defaultLoader.events;
  6. loader.require.install(deps, require);
  7. Glagol.noConflict = function noConflict () {
  8. delete window.Glagol;
  9. return app;
  10. }
  11. app().main();
  12. var socket = new WebSocket("ws://" + window.location.host);
  13. socket.onmessage = function (msg) {
  14. var data = JSON.parse(msg.data);
  15. switch (data.event) {
  16. case "glagol.added":
  17. loader.add(data.path, data.value);
  18. break;
  19. case "glagol.changed":
  20. loader.update(data.path, data.value);
  21. break;
  22. case "glagol.removed":
  23. loader.remove(data.path);
  24. break;
  25. }
  26. }
  27. })(%DEPS%, %ICE%)