UNPKG

potree

Version:

WebGL point cloud viewer - WORK IN PROGRESS

28 lines (20 loc) 453 B
Potree.WorkerPool = class WorkerPool { constructor () { this.workers = {}; } getWorker (url) { if (!this.workers[url]) { this.workers[url] = []; } if (this.workers[url].length === 0) { let worker = new Worker(url); this.workers[url].push(worker); } let worker = this.workers[url].pop(); return worker; } returnWorker (url, worker) { this.workers[url].push(worker); } }; Potree.workerPool = new Potree.WorkerPool();