()
| 26 | * Gets a worker from the recycle bin (pool) or makes a new one. |
| 27 | */ |
| 28 | const getWorkerFromPool = (): Worker => { |
| 29 | if (workerPool.length > 0) { |
| 30 | return workerPool.pop()!; |
| 31 | } |
| 32 | return new Worker(getWorkerBlobUrl(), {type: 'module'}); |
| 33 | }; |
| 34 | |
| 35 | /** |
| 36 | * Returns a used worker to the pool so it can process the next image. |
no test coverage detected