Class: Subject
A simplistic implementation of the Observer design pattern. You can understand more reading https://refactoring.guru/design-patterns/observer.
Hierarchy
Subject
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new Subject(): Subject
Returns
Properties
subscriptions
• subscriptions: Subscription[] = []
Defined in
Methods
notifySubscribers
▸ notifySubscribers(event): Promise\<void>
Parameters
| Name | Type |
|---|---|
event | Event |
Returns
Promise\<void>
Defined in
subscribe
▸ subscribe(callback): Subscription
Parameters
| Name | Type |
|---|---|
callback | SubscriptionCallback |
Returns
Defined in
unsubscribe
▸ unsubscribe(subscription): void
Parameters
| Name | Type |
|---|---|
subscription | Subscription |
Returns
void