From fa87168ffbb683aed495b7786a4d100510d29c04 Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Sat, 6 Mar 2021 15:56:38 +0000 Subject: [PATCH] feat(rstream): update PubSub - update PubSub generics - update .subscribeTopic() opts to use `TransformableOpts` --- packages/rstream/src/pubsub.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/rstream/src/pubsub.ts b/packages/rstream/src/pubsub.ts index f56ffcaf37..e31de7ba03 100644 --- a/packages/rstream/src/pubsub.ts +++ b/packages/rstream/src/pubsub.ts @@ -4,10 +4,10 @@ import { unsupported } from "@thi.ng/errors"; import type { Transducer } from "@thi.ng/transducers"; import { CloseMode, - CommonOpts, ISubscriber, LOGGER, SubscriptionOpts, + TransformableOpts, WithErrorHandlerOpts, } from "./api"; import { Subscription, subscription } from "./subscription"; @@ -62,13 +62,13 @@ export interface PubSubOpts { * * @param opts - */ -export const pubsub = (opts: PubSubOpts) => +export const pubsub = (opts: PubSubOpts) => new PubSub(opts); /** * @see {@link pubsub} for reference & examples. */ -export class PubSub extends Subscription { +export class PubSub extends Subscription { topicfn: Fn; topics: EquivMap>; @@ -101,23 +101,23 @@ export class PubSub extends Subscription { subscribeTopic( topicID: T, - opts?: Partial + opts?: Partial> ): Subscription; - subscribeTopic( + subscribeTopic( topicID: T, - sub: ISubscriber, - opts?: Partial - ): Subscription; + sub: ISubscriber, + opts?: Partial> + ): Subscription; subscribeTopic( topicID: T, sub: any, - opts?: Partial + opts?: Partial> ): Subscription { let t = this.topics.get(topicID); !t && this.topics.set( topicID, - (t = subscription(undefined, { + (t = subscription(undefined, { closeOut: CloseMode.NEVER, })) );