@graphql-mesh/transport-neo4j
Version:
30 lines (29 loc) • 880 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEventEmitterFromPubSub = void 0;
function getEventEmitterFromPubSub(pubsub) {
return {
on(event, listener) {
pubsub.subscribe(event.toString(), listener);
return this;
},
once(event, listener) {
const id = pubsub.subscribe(event.toString(), data => {
listener(data);
pubsub.unsubscribe(id);
});
return this;
},
emit(event, ...args) {
pubsub.publish(event.toString(), args[0]);
return true;
},
addListener(event, listener) {
return this.on(event, listener);
},
setMaxListeners() {
return this;
},
};
}
exports.getEventEmitterFromPubSub = getEventEmitterFromPubSub;
;