diff --git a/public/app/core/utils/CorsSharedWorker.ts b/public/app/core/utils/CorsSharedWorker.ts index 89bf9218b0b..4862a27da05 100644 --- a/public/app/core/utils/CorsSharedWorker.ts +++ b/public/app/core/utils/CorsSharedWorker.ts @@ -4,17 +4,6 @@ export function sharedWorkersSupported() { return typeof window.SharedWorker !== 'undefined'; } -class SharedWorkerNotSupported implements SharedWorker { - onerror() {} - // @ts-ignore - readonly port: MessagePort; - dispatchEvent(): boolean { - return false; - } - addEventListener(): void {} - removeEventListener(): void {} -} - /** * The base class is created dynamically here to allow later on syntax like: * import { CorsSharedWorker as SharedWorker } from '../utils/CorsSharedWorker'; @@ -23,13 +12,10 @@ class SharedWorkerNotSupported implements SharedWorker { * It's important to use: new SharedWorker(...) syntax instead of new CorsSharedWorker(...) due to how web-workers * are processing workers syntax (more details https://webpack.js.org/guides/web-workers/) */ -const BaseSharedWorkerClass = sharedWorkersSupported() ? window.SharedWorker : SharedWorkerNotSupported; +const BaseSharedWorkerClass = sharedWorkersSupported() ? window.SharedWorker : null; export class CorsSharedWorker extends BaseSharedWorkerClass { constructor(url: URL, options?: WorkerOptions) { - if (!sharedWorkersSupported()) { - return; - } // by default, worker inherits HTML document's location and pathname which leads to wrong public path value // the CorsWorkerPlugin will override it with the value based on the initial worker chunk, ie. // initial worker chunk: http://host.com/cdn/scripts/worker-123.js