Skip to main content

Class: ObserverManager<T>

Class that manages a set of observers that are notified when a new even is emitted.

Type parameters

Name
T

Constructors

constructor

new ObserverManager<T>(): ObserverManager<T>

Type parameters

Name
T

Returns

ObserverManager<T>

Defined in

packages/core/src/utils/observermanager.ts:10

Properties

observers

Private observers: Observer<T>[]

Defined in

packages/core/src/utils/observermanager.ts:8

Methods

addObserver

addObserver(observer): void

Adds an observer that will be called each time an event is emitted.

Parameters

NameTypeDescription
observerObserver<T>The observer to be called.

Returns

void

Defined in

packages/core/src/utils/observermanager.ts:18


emit

emit(newStatus): void

Notifies the observers.

Parameters

NameTypeDescription
newStatusTThe emitted event.

Returns

void

Defined in

packages/core/src/utils/observermanager.ts:46


removeAll

removeAll(): void

Removes all the observers.

Returns

void

Defined in

packages/core/src/utils/observermanager.ts:36


removeObserver

removeObserver(observer): void

Removes an observer so that it will not be called when an event is emitted.

Parameters

NameTypeDescription
observerObserver<T>The observer to be removed.

Returns

void

Defined in

packages/core/src/utils/observermanager.ts:26