chore(frontend): add comment related to using workers
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
// This function is used to create a worker that can load across domains.
|
// 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) {
|
export function corsWorker(workerUrl: string, options: WorkerOptions) {
|
||||||
const js = `import ${JSON.stringify(new URL(workerUrl, import.meta.url))}`;
|
const js = `import ${JSON.stringify(new URL(workerUrl, import.meta.url))}`;
|
||||||
const blob = new Blob([js], { type: 'application/javascript' });
|
const blob = new Blob([js], { type: 'application/javascript' });
|
||||||
|
|||||||
Reference in New Issue
Block a user