fix: revert BatchingWebSocket changes

This commit is contained in:
Jesse Mazzella 2024-04-12 13:23:36 -07:00
parent c0f2d95fa7
commit b597b7530e

View File

@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import installWorker from './WebSocketWorker.js';
/** /**
* Describes the strategy to be used when batching WebSocket messages * Describes the strategy to be used when batching WebSocket messages
* *
@ -69,7 +69,10 @@ class BatchingWebSocket extends EventTarget {
constructor(openmct) { constructor(openmct) {
super(); super();
// Install worker, register listeners etc. // Install worker, register listeners etc.
this.#worker = new Worker(new URL('./WebSocketWorker.js', import.meta.url)); const workerFunction = `(${installWorker.toString()})()`;
const workerBlob = new Blob([workerFunction]);
const workerUrl = URL.createObjectURL(workerBlob, { type: 'application/javascript' });
this.#worker = new Worker(workerUrl);
this.#openmct = openmct; this.#openmct = openmct;
this.#showingRateLimitNotification = false; this.#showingRateLimitNotification = false;
this.#maxBatchSize = Number.POSITIVE_INFINITY; this.#maxBatchSize = Number.POSITIVE_INFINITY;
@ -83,6 +86,7 @@ class BatchingWebSocket extends EventTarget {
'destroy', 'destroy',
() => { () => {
this.disconnect(); this.disconnect();
URL.revokeObjectURL(workerUrl);
}, },
{ once: true } { once: true }
); );