Skip to main content

Class: Subject

A simplistic implementation of the Observer design pattern. You can understand more reading https://refactoring.guru/design-patterns/observer.

Hierarchy​

Table of contents​

Constructors​

Properties​

Methods​

Constructors​

constructor​

• new Subject(): Subject

Returns​

Subject

Properties​

subscriptions​

• subscriptions: Subscription[] = []

Defined in​

src/subject.ts:8

Methods​

notifySubscribers​

▸ notifySubscribers(event): Promise\<void>

Parameters​

NameType
eventEvent

Returns​

Promise\<void>

Defined in​

src/subject.ts:20


subscribe​

▸ subscribe(callback): Subscription

Parameters​

NameType
callbackSubscriptionCallback

Returns​

Subscription

Defined in​

src/subject.ts:10


unsubscribe​

▸ unsubscribe(subscription): void

Parameters​

NameType
subscriptionSubscription

Returns​

void

Defined in​

src/subject.ts:16