Skip to main content

Class: BasePublisher<E>

A basic event-bus publisher.

Type parameters

NameType
Eextends Record<string, any>

Hierarchy

Constructors

constructor

new BasePublisher<E>(bus, pacer?): BasePublisher<E>

Creates an instance of BasePublisher.

Type parameters

NameType
Eextends Record<string, any>

Parameters

NameTypeDefault valueDescription
busEventBusundefinedThe common event bus.
pacerundefined | PublishPacer<E>undefinedAn optional pacer to control the rate of publishing.

Returns

BasePublisher<E>

Defined in

src/sdk/instruments/BasePublishers.ts:20

Properties

bus

Protected Readonly bus: EventBus

Defined in

src/sdk/instruments/BasePublishers.ts:10


pacer

Protected Readonly pacer: undefined | PublishPacer<E>

Defined in

src/sdk/instruments/BasePublishers.ts:13


publishActive

Protected publishActive: boolean

Defined in

src/sdk/instruments/BasePublishers.ts:12


publisher

Protected Readonly publisher: Publisher<E>

Defined in

src/sdk/instruments/BasePublishers.ts:11

Methods

isPublishing

isPublishing(): boolean

Tells whether or not the publisher is currently active.

Returns

boolean

True if the publisher is active, false otherwise.

Defined in

src/sdk/instruments/BasePublishers.ts:45


onUpdate

onUpdate(): void

A callback called when the publisher receives an update cycle.

Returns

void

Defined in

src/sdk/instruments/BasePublishers.ts:52


publish

publish<K>(topic, data, sync?, isCached?): void

Publish a message if publishing is acpive

Type parameters

NameType
Kextends string | number | symbol

Parameters

NameTypeDefault valueDescription
topicKundefinedThe topic key to publish to.
dataE[K]undefinedThe data type for chosen topic.
syncbooleanfalseWhether or not the event should be synced to other instruments. Defaults to false.
isCachedbooleantrueWhether or not the event should be cached. Defaults to true.

Returns

void

Defined in

src/sdk/instruments/BasePublishers.ts:63


startPublish

startPublish(): void

Start publishing.

Returns

void

Defined in

src/sdk/instruments/BasePublishers.ts:30


stopPublish

stopPublish(): void

Stop publishing.

Returns

void

Defined in

src/sdk/instruments/BasePublishers.ts:37