|
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:
876 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | /**
|
|---|
| 2 | * The hard-coded singleton key for webpack-hot-middleware's client instance.
|
|---|
| 3 | *
|
|---|
| 4 | * [Ref](https://github.com/webpack-contrib/webpack-hot-middleware/blob/cb29abb9dde435a1ac8e9b19f82d7d36b1093198/client.js#L152)
|
|---|
| 5 | */
|
|---|
| 6 | const singletonKey = '__webpack_hot_middleware_reporter__';
|
|---|
| 7 |
|
|---|
| 8 | /**
|
|---|
| 9 | * Initializes a socket server for HMR for webpack-hot-middleware.
|
|---|
| 10 | * @param {function(*): void} messageHandler A handler to consume Webpack compilation messages.
|
|---|
| 11 | * @returns {void}
|
|---|
| 12 | */
|
|---|
| 13 | function initWHMEventSource(messageHandler) {
|
|---|
| 14 | const client = window[singletonKey];
|
|---|
| 15 |
|
|---|
| 16 | client.useCustomOverlay({
|
|---|
| 17 | showProblems: function showProblems(type, data) {
|
|---|
| 18 | const error = {
|
|---|
| 19 | data: data,
|
|---|
| 20 | type: type,
|
|---|
| 21 | };
|
|---|
| 22 |
|
|---|
| 23 | messageHandler(error);
|
|---|
| 24 | },
|
|---|
| 25 | clear: function clear() {
|
|---|
| 26 | messageHandler({ type: 'ok' });
|
|---|
| 27 | },
|
|---|
| 28 | });
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | module.exports = { init: initWHMEventSource };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.