Web Worker数据获取问题:FetchWorker类代码相关技术问询
Web Worker数据获取逻辑技术问询
我实现了一个用于数据获取的Web Worker类,代码如下:
class FetchWorker { constructor(id) { this.id = id; this.ids = []; this.timer = 1; } start() { this.fetchData(); } addIds(ids) { this.ids.push(...ids); } sendData(method, data){ self.postMessage(JSON.stringify({ method, data })) } fetchData() { this.timer *= 2; console.log(this.id,') ### this', this); console.log(this.id,') ### ids', this.ids); console.log(this.id,') ### FetchData', this.ids.length, this.timer); console.log(this.id,') ######'); if(!this.ids.length) {... } }
现针对这个Web Worker的数据获取逻辑提出技术问询。
内容的提问来源于stack exchange,提问作者jagwe danfesa
相关产品推荐
相关产品推荐

