createReactiveStoreFromDataPublisher
Returns a ReactiveStore given a data publisher.
The store will update its state with each message published to dataChannelName and notify all
subscribers. When a message is published to errorChannelName, subscribers are notified so they
can react to the error condition, but the last-known state is preserved. Triggering the abort
signal disconnects the store from the data publisher.
Things to note:
getState()returnsundefineduntil the first notification arrives.- On error,
getState()continues to return the last known value andgetError()returns the error. Only the first error is captured. - The function returned by
subscribeis idempotent — calling it multiple times is safe.
Type Parameters
| Type Parameter |
|---|
TData |
Parameters
| Parameter | Type | Description |
|---|---|---|
config | Config | - |
Returns
ReactiveStore<TData>