Skip to main content

Built and signed on GitHub Actions

A collection of types and features for implementing the mediator pattern.

This package works with Node.js, DenoIt is unknown whether this package works with Cloudflare Workers, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
100%
Published
2 months ago (0.0.1)
interface TParticipant
extends TSubscriber<PubSubTopics<Pick<T, K>>, K>

Provides a mechanism to receive topical notifications from a Mediator instance.

Type Parameters

T extends PubSubTopics
  • The topics-to-type map of the types being observed.
K extends keyof T
  • The topics this subscriber supports.

Properties

readonly
topics: K[]

The topics this subscriber is subscribed to.

readonly
participantId: symbol

The unique identifier for this participant.

Methods

Publishes a message to the mediator.

subscribe(mediator: TBaseMediator<PubSubTopics<T>>): IDisposable

Subscribes the participant to a mediator.

Add Package

deno add jsr:@kz/mediator

Import symbol

import { type TParticipant } from "@kz/mediator";

---- OR ----

Import directly with a jsr specifier

import { type TParticipant } from "jsr:@kz/mediator";

Add Package

npx jsr add @kz/mediator

Import symbol

import { type TParticipant } from "@kz/mediator";

Add Package

yarn dlx jsr add @kz/mediator

Import symbol

import { type TParticipant } from "@kz/mediator";

Add Package

pnpm dlx jsr add @kz/mediator

Import symbol

import { type TParticipant } from "@kz/mediator";

Add Package

bunx jsr add @kz/mediator

Import symbol

import { type TParticipant } from "@kz/mediator";