()
| 15 | var errorHandlers = new Set(); |
| 16 | |
| 17 | var 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 |
no test coverage detected