@effection/channel
Advanced tools
Comparing version 0.6.1-3cde29a to 0.6.1-b1952e1
@@ -9,2 +9,3 @@ import { Operation } from 'effection'; | ||
subscribe(): Operation<Subscription<T, void>>; | ||
close(): void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Channel = void 0; | ||
const effection_1 = require("effection"); | ||
const subscription_1 = require("@effection/subscription"); | ||
@@ -21,6 +22,15 @@ const events_1 = require("@effection/events"); | ||
subscribe() { | ||
return subscription_1.Subscribable.from(events_1.on(this.bus, 'message')).map(([message]) => message)[subscription_1.SymbolSubscribable](); | ||
let { bus } = this; | ||
return subscription_1.createSubscription(function* (publish) { | ||
yield effection_1.spawn(subscription_1.forEach(events_1.on(bus, 'message'), function* ([message]) { | ||
publish(message); | ||
})); | ||
yield events_1.once(bus, 'close'); | ||
}); | ||
} | ||
close() { | ||
this.bus.emit('close'); | ||
} | ||
} | ||
exports.Channel = Channel; | ||
//# sourceMappingURL=channel.js.map |
{ | ||
"name": "@effection/channel", | ||
"version": "0.6.1-3cde29a", | ||
"version": "0.6.1-b1952e1", | ||
"description": "MPMC Channel implementation for effection", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5253
49
0