@effection/channel
Advanced tools
Comparing version 2.0.0-preview.3-ce76f15 to 2.0.0-preview.3-d36fe3e
@@ -24,4 +24,3 @@ 'use strict'; | ||
var _yield$subscription$n = yield subscription.next(), | ||
_yield$subscription$n2 = _yield$subscription$n.value, | ||
next = _yield$subscription$n2[0]; | ||
next = _yield$subscription$n.value; | ||
@@ -36,4 +35,3 @@ if (next.done) { | ||
}); | ||
return Object.assign({ | ||
stream: subscribable, | ||
return Object.assign(subscribable, { | ||
send: function send(message) { | ||
@@ -51,3 +49,3 @@ bus.emit('event', { | ||
} | ||
}, subscribable); | ||
}); | ||
} | ||
@@ -54,0 +52,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("@effection/subscription"),n=require("@effection/events"),t=require("events");exports.createChannel=function(r){void 0===r&&(r={});var i=new t.EventEmitter;r.maxSubscribers&&i.setMaxListeners(r.maxSubscribers);var s=e.createStream((function(e){return function*(t){for(var r=n.on(i,"event").subscribe(t);;){var s=(yield r.next()).value[0];if(s.done)return s.value;e(s.value)}}}));return Object.assign({stream:s,send:function(e){i.emit("event",{done:!1,value:e})},close:function(){i.emit("event",{done:!0,value:arguments.length<=0?void 0:arguments[0]})}},s)}; | ||
"use strict";var e=require("@effection/subscription"),n=require("@effection/events"),t=require("events");exports.createChannel=function(r){void 0===r&&(r={});var i=new t.EventEmitter;r.maxSubscribers&&i.setMaxListeners(r.maxSubscribers);var u=e.createStream((function(e){return function*(t){for(var r=n.on(i,"event").subscribe(t);;){var u=(yield r.next()).value;if(u.done)return u.value;e(u.value)}}}));return Object.assign(u,{send:function(e){i.emit("event",{done:!1,value:e})},close:function(){i.emit("event",{done:!0,value:arguments.length<=0?void 0:arguments[0]})}})}; | ||
//# sourceMappingURL=channel.cjs.production.min.js.map |
@@ -8,4 +8,3 @@ import { Stream } from '@effection/subscription'; | ||
close(...args: TClose extends undefined ? [] : [TClose]): void; | ||
stream: Stream<T, TClose>; | ||
} | ||
export declare function createChannel<T, TClose = undefined>(options?: ChannelOptions): Channel<T, TClose>; |
@@ -22,4 +22,3 @@ import { createStream } from '@effection/subscription'; | ||
var _yield$subscription$n = yield subscription.next(), | ||
_yield$subscription$n2 = _yield$subscription$n.value, | ||
next = _yield$subscription$n2[0]; | ||
next = _yield$subscription$n.value; | ||
@@ -34,4 +33,3 @@ if (next.done) { | ||
}); | ||
return Object.assign({ | ||
stream: subscribable, | ||
return Object.assign(subscribable, { | ||
send: function send(message) { | ||
@@ -49,3 +47,3 @@ bus.emit('event', { | ||
} | ||
}, subscribable); | ||
}); | ||
} | ||
@@ -52,0 +50,0 @@ |
{ | ||
"name": "@effection/channel", | ||
"version": "2.0.0-preview.3-ce76f15", | ||
"version": "2.0.0-preview.3-d36fe3e", | ||
"description": "MPMC Channel implementation for effection", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -12,3 +12,2 @@ import { createStream, Stream } from '@effection/subscription'; | ||
close(...args: TClose extends undefined ? [] : [TClose]): void; | ||
stream: Stream<T, TClose>; | ||
} | ||
@@ -26,3 +25,3 @@ | ||
while(true) { | ||
let { value: [next] } = yield subscription.next(); | ||
let { value: next } = yield subscription.next(); | ||
if(next.done) { | ||
@@ -36,5 +35,3 @@ return next.value; | ||
return Object.assign({ | ||
stream: subscribable, | ||
return Object.assign(subscribable, { | ||
send(message: T) { | ||
@@ -47,3 +44,3 @@ bus.emit('event', { done: false, value: message }); | ||
} | ||
}, subscribable); | ||
}); | ||
} |
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
16798
141