| 13 | }; |
| 14 | var log = require("./log"); |
| 15 | var check = function check() { |
| 16 | module.hot |
| 17 | .check(true) |
| 18 | .then(function (updatedModules) { |
| 19 | if (!updatedModules) { |
| 20 | log( |
| 21 | "warning", |
| 22 | "[HMR] Cannot find update. " + |
| 23 | (typeof window !== "undefined" |
| 24 | ? "Need to do a full reload!" |
| 25 | : "Please reload manually!") |
| 26 | ); |
| 27 | log( |
| 28 | "warning", |
| 29 | "[HMR] (Probably because of restarting the webpack-dev-server)" |
| 30 | ); |
| 31 | if (typeof window !== "undefined") { |
| 32 | window.location.reload(); |
| 33 | } |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | if (!upToDate()) { |
| 38 | check(); |
| 39 | } |
| 40 | |
| 41 | require("./log-apply-result")(updatedModules, updatedModules); |
| 42 | |
| 43 | if (upToDate()) { |
| 44 | log("info", "[HMR] App is up to date."); |
| 45 | } |
| 46 | }) |
| 47 | .catch(function (err) { |
| 48 | var status = module.hot.status(); |
| 49 | if (["abort", "fail"].indexOf(status) >= 0) { |
| 50 | log( |
| 51 | "warning", |
| 52 | "[HMR] Cannot apply update. " + |
| 53 | (typeof window !== "undefined" |
| 54 | ? "Need to do a full reload!" |
| 55 | : "Please reload manually!") |
| 56 | ); |
| 57 | log("warning", "[HMR] " + log.formatError(err)); |
| 58 | if (typeof window !== "undefined") { |
| 59 | window.location.reload(); |
| 60 | } |
| 61 | } else { |
| 62 | log("warning", "[HMR] Update failed: " + log.formatError(err)); |
| 63 | } |
| 64 | }); |
| 65 | }; |
| 66 | /** @type {EventTarget | NodeJS.EventEmitter} */ |
| 67 | var hotEmitter = require("./emitter"); |
| 68 | /** |