MCPcopy
hub / github.com/webpack/webpack / updateEventSource

Function updateEventSource

hot/lazy-compilation-web.js:17–48  ·  hot/lazy-compilation-web.js::updateEventSource
()

Source from the content-addressed store, hash-verified

15var errorHandlers = new Set();
16
17var updateEventSource = function updateEventSource() {
18 if (activeEventSource) activeEventSource.close();
19 if (activeKeys.size) {
20 activeEventSource = new EventSource(
21 urlBase + Array.from(activeKeys.keys()).join(class="st">"@")
22 );
23 /**
24 * @this {EventSource}
25 * @param {Event & { message?: string, filename?: string, lineno?: number, colno?: number, error?: Error }} event event
26 */
27 activeEventSource.onerror = function (event) {
28 errorHandlers.forEach(function (onError) {
29 onError(
30 new Error(
31 class="st">"Problem communicating active modules to the server: " +
32 event.message +
33 class="st">" " +
34 event.filename +
35 class="st">":" +
36 event.lineno +
37 class="st">":" +
38 event.colno +
39 class="st">" " +
40 event.error
41 )
42 );
43 });
44 };
45 } else {
46 activeEventSource = undefined;
47 }
48};
49
50/**
51 * @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options

Callers 1

Calls 4

onErrorFunction · 0.85
keysMethod · 0.65
closeMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected