evnty
Version:
Async-first, reactive event handling library for complex event flows in browser and Node.js
59 lines (57 loc) • 1.6 kB
JavaScript
import { Async } from "./async.js";
import { Signal } from "./signal.js";
import { RingBuffer } from "./ring-buffer.js";
export class Sequence extends Async {
[] = 'Sequence';
static merge(target, ...sequences) {
for (const source of sequences){
queueMicrotask(async ()=>{
if (!target.disposed) try {
const sink = target.sink;
for await (const value of source){
if (!sink(value)) {
return;
}
}
} catch {}
});
}
}
constructor(abortSignal){
super(abortSignal);
this.
this.
this.
}
get size() {
return this.
}
async reserve(capacity) {
while(this.
await this.
}
}
emit(value) {
const ok = !this.disposed;
if (ok) {
this.
}
this.
return ok;
}
async receive() {
while(!this.
await this.
}
this.
return this.
}
dispose() {
this.
this.
}
}
//# sourceMappingURL=sequence.js.map