#resolve: Function = (value: unknown): void => { }
#results: object[] = []
#threads: Thread[] = []
+ #url: string
get isDone (): boolean {
for (const thread of this.#threads) {
}
constructor (fn: string) {
- const url = URL.createObjectURL(new Blob([fn], { type: 'text/javascript' }))
+ this.#url = URL.createObjectURL(new Blob([fn], { type: 'text/javascript' }))
for (let i = this.#cores; i > 0; i--) {
const thread = {
isBusy: false,
//@ts-expect-error
- worker: new Worker(url, { type: 'module', eval: true })
+ worker: new Worker(this.#url, { type: 'module', eval: true })
}
thread.worker.addEventListener('message', message => {
const data = new TextDecoder().decode(message.data ?? message)