Private
Readonly
adapterPrivate
Readonly
configPrivate
Readonly
innerPrivate
Readonly
innerNotifies registry that user has read all data from conn that it wanted to read and conn is required no more.
It throws if conn with given id is not closed. It is no-op when conn with given id does not exist.
It's user responsibility via setConfig method to make it closable as soon as possible.
Generated using TypeDoc
Something like redux for connections of arbitrary type handled in async/await.
It accepts adapter responsible for actual connection handling logic. Adapter is, of course allowed to have it's own internal state, but state here can be accessed outside.
State here is not type provided by this library. Instead it should be your state for handling whatever domain logic you would like to handle.
Removing connections
This registry does not remove connections automatically once they ended. It's user responsibility to call
removeConn
. This way user can read data of any ended connection.Generic types
T - type of connection that comes from. This is like raw connection with no domain logic. S - State of each connection managed by adapter. Can be read outside of adapter, so things stored here can be displayed on UI or sth. C - Config of each connection. Used to send data to adapter. can be read outside of adapter. I - Initial data of connection that comes. This could be merged with T, but in for some reason in the past I didn't do so. It's also available outside adapter and unlike config and state can't be mutated during connections lifecycle.
If you are using react...
Check out
useStickyEventBus
fromtws-lts-react
and subscribe toinnerStateBus
to see how nice apis get then.