chore(frontend): add comment related to using workers

This commit is contained in:
Jack Westbrook
2025-03-03 09:52:52 +01:00
parent 1feace3bbe
commit db4ef2d0be
+6
View File
@@ -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' });