a zip code crypto-currency system good for red ONLY

dev-server.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. /*globals window __webpack_hash__ */
  6. if(module.hot) {
  7. var lastHash;
  8. var upToDate = function upToDate() {
  9. return lastHash.indexOf(__webpack_hash__) >= 0;
  10. };
  11. var log = require("./log");
  12. var check = function check() {
  13. module.hot.check(true).then(function(updatedModules) {
  14. if(!updatedModules) {
  15. log("warning", "[HMR] Cannot find update. Need to do a full reload!");
  16. log("warning", "[HMR] (Probably because of restarting the webpack-dev-server)");
  17. window.location.reload();
  18. return;
  19. }
  20. if(!upToDate()) {
  21. check();
  22. }
  23. require("./log-apply-result")(updatedModules, updatedModules);
  24. if(upToDate()) {
  25. log("info", "[HMR] App is up to date.");
  26. }
  27. }).catch(function(err) {
  28. var status = module.hot.status();
  29. if(["abort", "fail"].indexOf(status) >= 0) {
  30. log("warning", "[HMR] Cannot apply update. Need to do a full reload!");
  31. log("warning", "[HMR] " + err.stack || err.message);
  32. window.location.reload();
  33. } else {
  34. log("warning", "[HMR] Update failed: " + err.stack || err.message);
  35. }
  36. });
  37. };
  38. var hotEmitter = require("./emitter");
  39. hotEmitter.on("webpackHotUpdate", function(currentHash) {
  40. lastHash = currentHash;
  41. if(!upToDate() && module.hot.status() === "idle") {
  42. log("info", "[HMR] Checking for updates on the server...");
  43. check();
  44. }
  45. });
  46. log("info", "[HMR] Waiting for update signal from WDS...");
  47. } else {
  48. throw new Error("[HMR] Hot Module Replacement is disabled.");
  49. }