@fanoutio/eventstream
Version:
Connect-compatible middleware that enables the easy creation of EventStream endpoints
16 lines (15 loc) • 399 B
JavaScript
import ChannelWritable from './stream/ChannelWritable.js';
export default class ChannelPublisher {
parent;
channel;
constructor(parent, channel) {
this.parent = parent;
this.channel = channel;
}
async publishEvent(event) {
await this.parent.publishEvent(this.channel, event);
}
createWritable() {
return new ChannelWritable(this);
}
}