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' });