多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

18 lines
424 B

import getCrossOriginWorkerURL from 'crossoriginworker'
export async function initWorker(url: string) {
let worker: Worker | null = null
try {
if (/^https?:\/\//.test(url)) {
const workerURL = await getCrossOriginWorkerURL(url)
worker = new Worker(workerURL)
} else {
worker = new Worker(url, {
type: 'module',
})
}
} catch (e) {
console.error(e)
}
return worker
}