@effection/channel
Advanced tools
Comparing version 0.6.7-eb6cc78 to 0.6.7-f851981
@@ -14,4 +14,4 @@ 'use strict'; | ||
_proto[subscription.SymbolOperationIterable] = function (task) { | ||
return this.subscribe(task); | ||
_proto[subscription.SymbolSubscribable] = function* () { | ||
return yield this.subscribe(); | ||
}; | ||
@@ -30,6 +30,6 @@ | ||
_proto.subscribe = function subscribe(task) { | ||
_proto.subscribe = function subscribe() { | ||
var bus = this.bus; | ||
return subscription.Subscription.create(task, function* (publish) { | ||
var subscription = events.on(task, bus, 'event'); | ||
return subscription.createSubscription(function* (publish) { | ||
var subscription = yield events.on(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.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}(); | ||
"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 yield 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}(); | ||
//# sourceMappingURL=channel.cjs.production.min.js.map |
@@ -1,10 +0,10 @@ | ||
import { Task } from 'effection'; | ||
import { Subscription, SymbolOperationIterable, OperationIterator, OperationIterable } from '@effection/subscription'; | ||
export declare class Channel<T, TClose = undefined> implements OperationIterable<T, TClose> { | ||
import { Operation } from 'effection'; | ||
import { Subscribable, Subscription, SymbolSubscribable } from '@effection/subscription'; | ||
export declare class Channel<T, TClose = undefined> implements Subscribable<T, TClose> { | ||
private bus; | ||
[SymbolOperationIterable](task: Task): OperationIterator<T, TClose>; | ||
[SymbolSubscribable](): Operation<Subscription<T, TClose>>; | ||
setMaxListeners(value: number): void; | ||
send(message: T): void; | ||
subscribe(task: Task): Subscription<T, TClose>; | ||
subscribe(): import("@effection/subscription").ChainableSubscribable<unknown, any>; | ||
close(...args: TClose extends undefined ? [] : [TClose]): void; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { SymbolOperationIterable, Subscription } from '@effection/subscription'; | ||
import { SymbolSubscribable, createSubscription } from '@effection/subscription'; | ||
import { on } from '@effection/events'; | ||
@@ -12,4 +12,4 @@ import { EventEmitter } from 'events'; | ||
_proto[SymbolOperationIterable] = function (task) { | ||
return this.subscribe(task); | ||
_proto[SymbolSubscribable] = function* () { | ||
return yield this.subscribe(); | ||
}; | ||
@@ -28,6 +28,6 @@ | ||
_proto.subscribe = function subscribe(task) { | ||
_proto.subscribe = function subscribe() { | ||
var bus = this.bus; | ||
return Subscription.create(task, function* (publish) { | ||
var subscription = on(task, bus, 'event'); | ||
return createSubscription(function* (publish) { | ||
var subscription = yield on(bus, 'event'); | ||
@@ -34,0 +34,0 @@ while (true) { |
{ | ||
"name": "@effection/channel", | ||
"version": "0.6.7-eb6cc78", | ||
"version": "0.6.7-f851981", | ||
"description": "MPMC Channel implementation for effection", | ||
@@ -34,6 +34,6 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"effection": "^2.0.0", | ||
"@effection/events": "^2.0.0", | ||
"@effection/subscription": "^2.0.0" | ||
"effection": "^0.7.0", | ||
"@effection/events": "^0.7.8", | ||
"@effection/subscription": "^0.11.0" | ||
} | ||
} |
@@ -22,3 +22,3 @@ # @effection/channel | ||
import { main } from '@effection/node'; | ||
import { sleep } from 'effection'; | ||
import { timeout } from 'effection'; | ||
@@ -30,3 +30,3 @@ main(function*() { | ||
while(true) { | ||
yield sleep(1000); | ||
yield timeout(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
13918
+ Added@effection/events@0.7.9(transitive)
+ Added@effection/subscription@0.11.10.12.0(transitive)
+ Addedeffection@0.7.00.8.0(transitive)
- Removed@chainsafe/abort-controller@3.0.1(transitive)
- Removed@effection/channel@2.0.6(transitive)
- Removed@effection/core@2.2.3(transitive)
- Removed@effection/events@2.0.6(transitive)
- Removed@effection/fetch@2.0.7(transitive)
- Removed@effection/main@2.1.2(transitive)
- Removed@effection/mocha@2.0.8(transitive)
- Removed@effection/stream@2.0.6(transitive)
- Removed@effection/subscription@2.0.6(transitive)
- Removedansi-colors@4.1.3(transitive)
- Removedansi-regex@5.0.1(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedanymatch@3.1.3(transitive)
- Removedargparse@2.0.1(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbinary-extensions@2.3.0(transitive)
- Removedbrace-expansion@2.0.1(transitive)
- Removedbraces@3.0.3(transitive)
- Removedbrowser-stdout@1.3.1(transitive)
- Removedcamelcase@6.3.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedchokidar@3.6.0(transitive)
- Removedcliui@7.0.4(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcross-fetch@3.1.5(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddecamelize@4.0.0(transitive)
- Removeddiff@5.2.0(transitive)
- Removedeffection@2.0.8(transitive)
- Removedemoji-regex@8.0.0(transitive)
- Removedescalade@3.2.0(transitive)
- Removedescape-string-regexp@4.0.0(transitive)
- Removedevent-target-shim@5.0.1(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedfind-up@5.0.0(transitive)
- Removedflat@5.0.2(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfsevents@2.3.3(transitive)
- Removedget-caller-file@2.0.5(transitive)
- Removedglob@8.1.0(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedhe@1.2.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-binary-path@2.1.0(transitive)
- Removedis-extglob@2.1.1(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedis-glob@4.0.3(transitive)
- Removedis-number@7.0.0(transitive)
- Removedis-plain-obj@2.1.0(transitive)
- Removedis-unicode-supported@0.1.0(transitive)
- Removedjs-yaml@4.1.0(transitive)
- Removedlocate-path@6.0.0(transitive)
- Removedlog-symbols@4.1.0(transitive)
- Removedminimatch@5.1.6(transitive)
- Removedmocha@10.7.3(transitive)
- Removedms@2.1.3(transitive)
- Removednode-fetch@2.6.7(transitive)
- Removednormalize-path@3.0.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-limit@3.1.0(transitive)
- Removedp-locate@5.0.0(transitive)
- Removedpath-exists@4.0.0(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedrandombytes@2.1.0(transitive)
- Removedreaddirp@3.6.0(transitive)
- Removedrequire-directory@2.1.1(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedserialize-javascript@6.0.2(transitive)
- Removedstacktrace-parser@0.1.10(transitive)
- Removedstring-width@4.2.3(transitive)
- Removedstrip-ansi@6.0.1(transitive)
- Removedstrip-json-comments@3.1.1(transitive)
- Removedsupports-color@7.2.08.1.1(transitive)
- Removedto-regex-range@5.0.1(transitive)
- Removedtr46@0.0.3(transitive)
- Removedtype-fest@0.7.1(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedworkerpool@6.5.1(transitive)
- Removedwrap-ansi@7.0.0(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedy18n@5.0.8(transitive)
- Removedyargs@16.2.0(transitive)
- Removedyargs-parser@20.2.9(transitive)
- Removedyargs-unparser@2.0.0(transitive)
- Removedyocto-queue@0.1.0(transitive)
Updated@effection/events@^0.7.8
Updatedeffection@^0.7.0