static #threads: Thread[] = []
static #cores: number = Math.max(1, navigator.hardwareConcurrency - 1)
static #queue: Job[] = []
+ static #url: string = URL.createObjectURL(new Blob([Workers], { type: 'text/javascript' }))
static {
- const url = URL.createObjectURL(new Blob([Workers], { type: 'text/javascript' }))
for (let i = this.#cores; i > 0; i--) {
const thread = {
- worker: new Worker(url, { type: 'module' }),
+ worker: new Worker(this.#url, { type: 'module' }),
job: null
}
thread.worker.addEventListener('message', message => {