@speckle/objectloader2
Version:
This is an updated objectloader for the Speckle viewer written in typescript
33 lines • 989 B
JavaScript
export default class AsyncGeneratorQueue {
add(value) {
if (this.
// If there's a pending consumer, resolve immediately
const resolve = this.
resolve(value);
}
else {
// Otherwise, add to the buffer
this.
}
}
async *consume() {
while (!this.
this.
this.
if (this.
yield this.
}
else {
yield await new Promise((resolve) => this.
}
}
}
disposeAsync() {
this.
return Promise.resolve();
}
}
//# sourceMappingURL=asyncGeneratorQueue.js.map