forked from fanruan/fineui
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.
26 lines
803 B
26 lines
803 B
import { ${WorkerName}MainThreadWorker } from './new_main_thread'; |
|
// 不需要一起打包的话则不需要引入这行 |
|
import { workerUrl } from 'fui-worker!../worker_thread/new_worker_thread'; |
|
|
|
// MainThread的创建在helper层处理 |
|
export class ${WorkerName}MainThreadWorkerHelper { |
|
public createMainTreadWorker() { |
|
return BI.Workers.createWorker(${WorkerName}MainThreadWorker, { |
|
workerUrl: this.urlFormatter(workerUrl), |
|
workerName: BI.UUID(), |
|
}); |
|
} |
|
|
|
private urlFormatter(v: string) { |
|
return v; |
|
} |
|
} |
|
|
|
export const mainThreadWorkerHelper = new ${WorkerName}MainThreadWorkerHelper(); |
|
|
|
// 调用示例 |
|
mainThreadWorkerHelper.createMainTreadWorker() |
|
.testCommunication() |
|
.then(res => { |
|
console.log(res) |
|
}) |