IHMSStore

HMS Reactive store can be used to subscribe to different parts of the store using selectors and get a callback when the value changes.

Hierarchy

Properties

destroy

destroy: Destroy

Inherited from

IStore.destroy


getState

getState: GetState<HMSStore>

Get a part of store using a selector which is true at the current point of time.

Usage: store.getState(selectDominantSpeaker);

Inherited from

IStore.getState


setState

setState: SetState<HMSStore>

Inherited from

IStore.setState


subscribe

subscribe: Subscribe<HMSStore>

Subscribe to a part of store using selectors, whenever the subscribed part changes, the callback is called with both the latest and previous value of the changed part.

Usage:

const onSpeakerUpdate = (speaker, prevSpeaker) => { console.log("speaker changed from - ", prevSpeaker, ", to - ", speaker); } store.subscribe(onSpeakerUpdate, selectDominantSpeaker);

Inherited from

IStore.subscribe