|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Author Tobias Koppers @sokra
|
|---|
| 4 | */
|
|---|
| 5 | /* globals __resourceQuery */
|
|---|
| 6 | if (module.hot) {
|
|---|
| 7 | // eslint-disable-next-line no-implicit-coercion
|
|---|
| 8 | var hotPollInterval = +__resourceQuery.slice(1) || 10 * 60 * 1000;
|
|---|
| 9 | var log = require("./log");
|
|---|
| 10 |
|
|---|
| 11 | /**
|
|---|
| 12 | * @param {boolean=} fromUpdate true when called from update
|
|---|
| 13 | */
|
|---|
| 14 | var checkForUpdate = function checkForUpdate(fromUpdate) {
|
|---|
| 15 | if (module.hot.status() === "idle") {
|
|---|
| 16 | module.hot
|
|---|
| 17 | .check(true)
|
|---|
| 18 | .then(function (updatedModules) {
|
|---|
| 19 | if (!updatedModules) {
|
|---|
| 20 | if (fromUpdate) log("info", "[HMR] Update applied.");
|
|---|
| 21 | return;
|
|---|
| 22 | }
|
|---|
| 23 | require("./log-apply-result")(updatedModules, updatedModules);
|
|---|
| 24 | checkForUpdate(true);
|
|---|
| 25 | })
|
|---|
| 26 | .catch(function (err) {
|
|---|
| 27 | var status = module.hot.status();
|
|---|
| 28 | if (["abort", "fail"].indexOf(status) >= 0) {
|
|---|
| 29 | log("warning", "[HMR] Cannot apply update.");
|
|---|
| 30 | log("warning", "[HMR] " + log.formatError(err));
|
|---|
| 31 | log("warning", "[HMR] You need to restart the application!");
|
|---|
| 32 | } else {
|
|---|
| 33 | log("warning", "[HMR] Update failed: " + log.formatError(err));
|
|---|
| 34 | }
|
|---|
| 35 | });
|
|---|
| 36 | }
|
|---|
| 37 | };
|
|---|
| 38 | setInterval(checkForUpdate, hotPollInterval);
|
|---|
| 39 | } else {
|
|---|
| 40 | throw new Error("[HMR] Hot Module Replacement is disabled.");
|
|---|
| 41 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.