@effection/channel
Advanced tools
Comparing version 0.6.1-388321e to 0.6.1-3cde29a
import { Operation } from 'effection'; | ||
import { Subscription, FilterChannel, MapChannel, Mapper, Predicate } from './index'; | ||
export declare type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends Array<infer I> ? Array<DeepPartial<I>> : DeepPartial<T[P]>; | ||
}; | ||
export declare abstract class Channel<T> { | ||
abstract subscribe(): Operation<Subscription<T>>; | ||
once(): Operation<T>; | ||
filter(predicate: Predicate<T>): FilterChannel<T>; | ||
map<R>(mapper: Mapper<T, R>): MapChannel<T, R>; | ||
match(reference: DeepPartial<T>): FilterChannel<T>; | ||
import { Subscribable, Subscription, SymbolSubscribable } from '@effection/subscription'; | ||
export declare class Channel<T> implements Subscribable<T, void> { | ||
private bus; | ||
[SymbolSubscribable](): Operation<Subscription<T, void>>; | ||
setMaxListeners(value: number): void; | ||
send(message: T): void; | ||
subscribe(): Operation<Subscription<T, void>>; | ||
} |
export { Channel } from './channel'; | ||
export { Subscription } from './subscription'; | ||
export { SendChannel, SendChannelSubscription } from './send-channel'; | ||
export { MapChannel, MapChannelSubscription, Mapper } from './map-channel'; | ||
export { FilterChannel, FilterChannelSubscription, Predicate } from './filter-channel'; | ||
export { EventChannel } from './event-channel'; | ||
import { SendChannel } from './send-channel'; | ||
import { EventChannel } from './event-channel'; | ||
import { EventSource } from '@effection/events'; | ||
export declare function createChannel<T>(): SendChannel<T>; | ||
export declare function createEventChannel(eventSource: EventSource, eventName: string): EventChannel; |
@@ -1,8 +0,5 @@ | ||
'use strict' | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./channel.cjs.production.min.js') | ||
} else { | ||
module.exports = require('./channel.cjs.development.js') | ||
} | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var channel_1 = require("./channel"); | ||
Object.defineProperty(exports, "Channel", { enumerable: true, get: function () { return channel_1.Channel; } }); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@effection/channel", | ||
"version": "0.6.1-388321e", | ||
"description": "MPSP Channel implementation for effection", | ||
"version": "0.6.1-3cde29a", | ||
"description": "MPMC Channel implementation for effection", | ||
"main": "dist/index.js", | ||
"module": "dist/channel.esm.js", | ||
"types": "dist/index.d.ts", | ||
"typings": "dist/index.d.js", | ||
"repository": "https://github.com/thefrontside/bigtest.git", | ||
@@ -13,3 +12,2 @@ "author": "Frontside Engineering <engineering@frontside.io>", | ||
"dist/*", | ||
"src", | ||
"README.md" | ||
@@ -20,3 +18,3 @@ ], | ||
"test": "mocha -r ts-node/register test/**/*.test.ts", | ||
"prepack": "tsdx build --tsconfig tsconfig.dist.json", | ||
"prepack": "tsc --outdir dist --project tsconfig.dist.json --declaration --sourcemap --module commonjs", | ||
"mocha": "mocha -r ts-node/register" | ||
@@ -27,5 +25,4 @@ }, | ||
"expect": "^25.4.0", | ||
"mocha": "^7.1.1", | ||
"mocha": "^7.2.0", | ||
"ts-node": "^8.9.0", | ||
"tsdx": "0.13.2", | ||
"typescript": "^3.7.0" | ||
@@ -39,3 +36,7 @@ }, | ||
"yarn": "1.19.1" | ||
}, | ||
"dependencies": { | ||
"@effection/events": "^0.7.1", | ||
"@effection/subscription": "^0.7.1" | ||
} | ||
} |
# @effection/channel | ||
A multi producer, multi consumer channel for Effection. Channels are useful for | ||
communicating between different parts of a system, for building pubsub buses, or | ||
a whole lot of other synchronization needs. | ||
A multi producer, multi consumer unbounded channel for Effection. Channels are | ||
useful for communicating between different parts of a system, for building | ||
pubsub buses, or a whole lot of other synchronization needs. | ||
@@ -11,2 +11,6 @@ Sending to a channel is synchronous and does not require the sender to be | ||
Because of the synchronous nature of sends, channels are unbounded in size, which | ||
means that they cannot handle backpressure. As such, channels should be used more | ||
as a synchronization mechanism, rather than a high-throughput system. | ||
## Usage | ||
@@ -34,5 +38,5 @@ | ||
while(true) { | ||
let value = yield subscription.next(); | ||
let { value } = yield subscription.next(); | ||
console.log("value:", value); | ||
} | ||
}); |
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
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
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
5
2
41
1
4741
3
9
38
1
+ Added@effection/events@^0.7.1
+ Added@effection/events@0.7.9(transitive)
+ Added@effection/subscription@0.12.00.7.3(transitive)
+ Addedeffection@0.7.00.8.0(transitive)