@effection/channel
Advanced tools
Comparing version 0.6.6 to 0.6.7-eb6cc78
# Changelog | ||
## 0.6.7 | ||
### Patch Changes | ||
- 25b68eb: Subscriptions created via `createSubscription` are chainable on both sides of the yield | ||
- Updated dependencies [25b68eb] | ||
- @effection/subscription@0.11.0 | ||
- @effection/events@0.7.8 | ||
## 0.6.6 | ||
@@ -4,0 +13,0 @@ |
@@ -14,4 +14,4 @@ 'use strict'; | ||
_proto[subscription.SymbolSubscribable] = function () { | ||
return this.subscribe(); | ||
_proto[subscription.SymbolOperationIterable] = function (task) { | ||
return this.subscribe(task); | ||
}; | ||
@@ -30,6 +30,6 @@ | ||
_proto.subscribe = function subscribe() { | ||
_proto.subscribe = function subscribe(task) { | ||
var bus = this.bus; | ||
return subscription.createSubscription(function* (publish) { | ||
var subscription = yield events.on(bus, 'event'); | ||
return subscription.Subscription.create(task, function* (publish) { | ||
var subscription = events.on(task, bus, 'event'); | ||
@@ -36,0 +36,0 @@ while (true) { |
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("@effection/subscription"),t=require("@effection/events"),n=require("events");exports.Channel=function(){function i(){this.bus=new n.EventEmitter}var r=i.prototype;return r[e.SymbolSubscribable]=function(){return this.subscribe()},r.setMaxListeners=function(e){this.bus.setMaxListeners(e)},r.send=function(e){this.bus.emit("event",{done:!1,value:e})},r.subscribe=function(){var n=this.bus;return e.createSubscription((function*(e){for(var i=yield t.on(n,"event");;){var r=(yield i.expect())[0];if(r.done)return r.value;e(r.value)}}))},r.close=function(){this.bus.emit("event",{done:!0,value:arguments.length<=0?void 0:arguments[0]})},i}(); | ||
"use strict";var e=require("@effection/subscription"),t=require("@effection/events"),n=require("events");exports.Channel=function(){function i(){this.bus=new n.EventEmitter}var r=i.prototype;return r[e.SymbolOperationIterable]=function(e){return this.subscribe(e)},r.setMaxListeners=function(e){this.bus.setMaxListeners(e)},r.send=function(e){this.bus.emit("event",{done:!1,value:e})},r.subscribe=function(n){var i=this.bus;return e.Subscription.create(n,(function*(e){for(var r=t.on(n,i,"event");;){var s=(yield r.expect())[0];if(s.done)return s.value;e(s.value)}}))},r.close=function(){this.bus.emit("event",{done:!0,value:arguments.length<=0?void 0:arguments[0]})},i}(); | ||
//# sourceMappingURL=channel.cjs.production.min.js.map |
@@ -1,10 +0,10 @@ | ||
import { Operation } from 'effection'; | ||
import { Subscribable, Subscription, SymbolSubscribable } from '@effection/subscription'; | ||
export declare class Channel<T, TClose = undefined> implements Subscribable<T, TClose> { | ||
import { Task } from 'effection'; | ||
import { Subscription, SymbolOperationIterable, OperationIterator, OperationIterable } from '@effection/subscription'; | ||
export declare class Channel<T, TClose = undefined> implements OperationIterable<T, TClose> { | ||
private bus; | ||
[SymbolSubscribable](): Operation<Subscription<T, TClose>>; | ||
[SymbolOperationIterable](task: Task): OperationIterator<T, TClose>; | ||
setMaxListeners(value: number): void; | ||
send(message: T): void; | ||
subscribe(): Operation<Subscription<T, TClose>>; | ||
subscribe(task: Task): Subscription<T, TClose>; | ||
close(...args: TClose extends undefined ? [] : [TClose]): void; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { SymbolSubscribable, createSubscription } from '@effection/subscription'; | ||
import { SymbolOperationIterable, Subscription } from '@effection/subscription'; | ||
import { on } from '@effection/events'; | ||
@@ -12,4 +12,4 @@ import { EventEmitter } from 'events'; | ||
_proto[SymbolSubscribable] = function () { | ||
return this.subscribe(); | ||
_proto[SymbolOperationIterable] = function (task) { | ||
return this.subscribe(task); | ||
}; | ||
@@ -28,6 +28,6 @@ | ||
_proto.subscribe = function subscribe() { | ||
_proto.subscribe = function subscribe(task) { | ||
var bus = this.bus; | ||
return createSubscription(function* (publish) { | ||
var subscription = yield on(bus, 'event'); | ||
return Subscription.create(task, function* (publish) { | ||
var subscription = on(task, bus, 'event'); | ||
@@ -34,0 +34,0 @@ while (true) { |
{ | ||
"name": "@effection/channel", | ||
"version": "0.6.6", | ||
"version": "0.6.7-eb6cc78", | ||
"description": "MPMC Channel implementation for effection", | ||
@@ -34,6 +34,6 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"effection": "^0.7.0", | ||
"@effection/events": "^0.7.7", | ||
"@effection/subscription": "^0.10.0" | ||
"effection": "^2.0.0", | ||
"@effection/events": "^2.0.0", | ||
"@effection/subscription": "^2.0.0" | ||
} | ||
} |
@@ -22,3 +22,3 @@ # @effection/channel | ||
import { main } from '@effection/node'; | ||
import { timeout } from 'effection'; | ||
import { sleep } from 'effection'; | ||
@@ -30,3 +30,3 @@ main(function*() { | ||
while(true) { | ||
yield timeout(1000); | ||
yield sleep(1000); | ||
channel.send({ message: "ping" }); | ||
@@ -33,0 +33,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14405
+ Added@chainsafe/abort-controller@3.0.1(transitive)
+ Added@effection/channel@2.0.6(transitive)
+ Added@effection/core@2.2.3(transitive)
+ Added@effection/events@2.0.6(transitive)
+ Added@effection/fetch@2.0.7(transitive)
+ Added@effection/main@2.1.2(transitive)
+ Added@effection/mocha@2.0.8(transitive)
+ Added@effection/stream@2.0.6(transitive)
+ Added@effection/subscription@2.0.6(transitive)
+ Addedansi-colors@4.1.3(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedanymatch@3.1.3(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbinary-extensions@2.3.0(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedbrowser-stdout@1.3.1(transitive)
+ Addedcamelcase@6.3.0(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedchokidar@3.6.0(transitive)
+ Addedcliui@7.0.4(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcross-fetch@3.1.5(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddecamelize@4.0.0(transitive)
+ Addeddiff@5.2.0(transitive)
+ Addedeffection@2.0.8(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedescape-string-regexp@4.0.0(transitive)
+ Addedevent-target-shim@5.0.1(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedfind-up@5.0.0(transitive)
+ Addedflat@5.0.2(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfsevents@2.3.3(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedglob@8.1.0(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedhe@1.2.0(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-binary-path@2.1.0(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedis-plain-obj@2.1.0(transitive)
+ Addedis-unicode-supported@0.1.0(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedlocate-path@6.0.0(transitive)
+ Addedlog-symbols@4.1.0(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addedmocha@10.7.3(transitive)
+ Addedms@2.1.3(transitive)
+ Addednode-fetch@2.6.7(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedrandombytes@2.1.0(transitive)
+ Addedreaddirp@3.6.0(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedserialize-javascript@6.0.2(transitive)
+ Addedstacktrace-parser@0.1.10(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedstrip-json-comments@3.1.1(transitive)
+ Addedsupports-color@7.2.08.1.1(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedtype-fest@0.7.1(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
+ Addedworkerpool@6.5.1(transitive)
+ Addedwrap-ansi@7.0.0(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedy18n@5.0.8(transitive)
+ Addedyargs@16.2.0(transitive)
+ Addedyargs-parser@20.2.9(transitive)
+ Addedyargs-unparser@2.0.0(transitive)
+ Addedyocto-queue@0.1.0(transitive)
- Removed@effection/events@0.7.9(transitive)
- Removed@effection/subscription@0.10.00.12.0(transitive)
- Removedeffection@0.7.00.8.0(transitive)
Updated@effection/events@^2.0.0
Updatedeffection@^2.0.0