(workerFactory: () => Worker, size = navigator.hardwareConcurrency ?? 2)
| 22 | private readonly workerFactory: () => Worker; |
| 23 | |
| 24 | constructor(workerFactory: () => Worker, size = navigator.hardwareConcurrency ?? 2) { |
| 25 | this.workerFactory = workerFactory; |
| 26 | this.size = Math.min(size, 4); // Cap at 4 to avoid too many threads |
| 27 | } |
| 28 | |
| 29 | private createSlot(): WorkerSlot { |
| 30 | const worker = this.workerFactory(); |
nothing calls this directly
no outgoing calls
no test coverage detected