From db4ef2d0be96aad3b56c40df2aa6f378fda33733 Mon Sep 17 00:00:00 2001 From: Jack Westbrook Date: Tue, 10 Dec 2024 10:57:55 +0100 Subject: [PATCH] chore(frontend): add comment related to using workers --- public/app/core/utils/CorsWorker.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/app/core/utils/CorsWorker.ts b/public/app/core/utils/CorsWorker.ts index b9bfa56cdc7..e8b0032fab3 100644 --- a/public/app/core/utils/CorsWorker.ts +++ b/public/app/core/utils/CorsWorker.ts @@ -1,4 +1,10 @@ // This function is used to create a worker that can load across domains. +// To use it, you need to import the workerUrl and pass it as the first argument. +// +// import clientWorkerUrl from './client.worker?worker&url'; +// +// corsWorker(clientWorkerUrl, { name: 'myWorker' }); +// export function corsWorker(workerUrl: string, options: WorkerOptions) { const js = `import ${JSON.stringify(new URL(workerUrl, import.meta.url))}`; const blob = new Blob([js], { type: 'application/javascript' });