@azothjs/channels
Advanced tools
Comparing version 0.3.4 to 0.3.5
import { Multicast } from './Multicast.js'; | ||
import { AsyncTypeError } from './throw.js'; | ||
import { channel } from './channel.js'; | ||
import { Sync } from '../maya/compose/compose.js'; | ||
@@ -6,0 +5,0 @@ export function branch(async, ...transforms) { |
import { Sync } from '../maya/compose/compose.js'; | ||
import { resolveArgs } from './resolve-args.js'; | ||
import { AsyncTypeError, InitOptionWithSyncWrappedAsyncProviderError, OptionMissingFunctionArgumentError } from './throw.js'; | ||
import { AsyncTypeError, InitOptionWithSyncWrappedAsyncProviderError } from './throw.js'; | ||
@@ -5,0 +5,0 @@ export function channel(async, transformArg, options) { |
import { Sync } from '../maya/compose/compose.js'; | ||
import { generator } from './generator.js'; | ||
import { observe } from './unicast.js'; | ||
export class Multicast { | ||
#consumers = []; | ||
#async = null; | ||
#started = false; | ||
#initial; | ||
#iter = null; | ||
constructor(async) { | ||
if(async instanceof Sync) { | ||
const { initial, input } = async; | ||
this.#async = input; | ||
this.#initial = initial; | ||
} | ||
else { | ||
this.#async = async; | ||
} | ||
constructor(iter) { | ||
this.#iter = (iter instanceof Sync) ? iter.input : iter; | ||
this.start(); | ||
@@ -24,6 +14,5 @@ } | ||
async start() { | ||
const async = this.#async; | ||
this.#started = true; | ||
for await(let value of async) { | ||
for(let consumer of this.#consumers) { | ||
const iter = this.#iter; | ||
for await(const value of iter) { | ||
for(const consumer of this.#consumers) { | ||
consumer(value); | ||
@@ -34,6 +23,2 @@ } | ||
channel(transform, options) { | ||
} | ||
subscriber(transform, options) { | ||
@@ -40,0 +25,0 @@ const [iterator, next] = generator(transform, options); |
{ | ||
"name": "@azothjs/channels", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "Asynchronous layout channels", | ||
@@ -5,0 +5,0 @@ "author": "Marty Nelson", |
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
15010
399