The constructor takes a pure function implementing SignalsBuild.
a pure function mapping from CONFIG to Signals
Readonly builda pure function mapping from CONFIG to Signals
addEffectId can be used as a short alternative to mapEffects, if you want
to add just a single EffectId to the effect-ids.
SignalsFactory with modified effect-idsa concrete string to be used as key for the new EffectId
a concrete EffectId type
the name of the new EffectId
a function returning the new EffectId
addInputId can be used as a short alternative to mapInput, if you want
to add just a single SignalId to the input signal ids.
SignalsFactory with modified input signalsa concrete string to be used as key for the new SignalId
a concrete SignalId type
the name of the new SignalId
a function returning the new SignalId
addOutputId can be used as a short alternative to mapOutput, if you want
to add just a single SignalId to the output signal ids.
SignalsFactory with modified output signalsa concrete string to be used as key for the new SignalId
a concrete SignalId type
the name of the new SignalId
a function returning the new SignalId
This method implements monadic-bind for the SignalsFactory.
It takes as argument a pure function that implements SignalsMapToFactory<IN, OUT, CONFIG, EFF, IN2, OUT2, CONFIG2, EFF2>, hence
a function taking SignalsBuild<IN, OUT, CONFIG, EFF> as argument and returning a SignalsFactory<IN2, OUT2, CONFIG2, EFF2>.
The result of bind is a new SignalsFactory that uses the SignalsBuild<IN2, OUT2, CONFIG2, EFF2>::build
of the factory returned from the mapper (hence the result of bind is not the same instance as returned by the mapper).
SignalsFactory<IN2, OUT2, CONFIG2, EFF2>a pure function mapping from SignalsBuild<IN, OUT, CONFIG, EFF> to SignalsFactory<IN2, OUT2, CONFIG2, EFF2>
The compose method takes a second SignalsFactory2 and returns a new SignalsFactory
that represents the composition of this SignalsFactory and the argument SignalsFactory2.
You can re-map the input, output, configuration and effects of the resulting composed SignalsFactory
by using mapInput, mapOutput, mapConfig and mapEffects correspondingly (as well as the many other convenience methods).
SignalsFactory resulting from the composition of this SignalsFactory and SignalsFactory2a SignalsFactory
The connect method offers an easy way to connect an output signal to an input signal.
It takes the name of an output-id (a key of OUT) as first argument and the name of an input-id (a key of IN) as second argument.
If keepInputId is set to true, it returns a new SignalsFactory of the same type as this SignalsFactory,
but with an extended setup logic, that connects the Signal<S extends T> that corresponds to the named output-id to a
new Signal<T> corresponding to the named input-id.
If keepInputId is set to false, it also extends the setup logic to connect the corresponding signal-ids, but in addition
the specified input-id will be excluded from the IN-type of the resulting factory.
(also see store.connect documentation, as this is used under the hood)
Typescript will enforce that both names (keys) map to compatible signal ids, hence if KIN corresponds to SignalId<T>,
then KOUT must correspond to SignalId<S extends T> (though one might be an EventId and the other a BehaviorId).
Even though you only use strings as arguments, this method is still type-safe and will not compile if you try to specify names of non-existing or incompatible ids.
SignalsFactory with the concrete type depending on the keepInputId argumenta key of OUT, where OUT[outputName] must be of type Signal<S extends T>
a key of IN, where IN[toName] must be of type Signal<T>
if set to false, the input-id corresponding to toName will be removed from the resulting factories' IN
The connectId method is a more general version of the connect method. In contrast to connect, it does not take the name
of an OUT signal-id, but instead directly a signal-id (thus, some arbitrary signal-id can be used).
Everything else works like connect, so please see the corresponding documentation there.
SignalsFactory with the concrete type depending on the keepInputId argumenta Signal<S extends T>
a key of IN, where IN[toName] must be of type Signal<T>
if set to false, the input-id corresponding to toName will be removed from the resulting factories' IN
The connectObservable method is even more general compared to the connect and connectId methods. In contrast to the previous two,
its first argument is a function that takes store, output and config as arguments and returns an observable.
For the other arguments, please see the documentation of the connect method.
SignalsFactory with the concrete type depending on the keepInputId argumenta function returning an Observable<S extends T>
a key of IN, where IN[toName] must be of type Signal<T>
if set to false, the input-id corresponding to toName will be removed from the resulting factories' IN
The extendSetup method takes as argument a function that implements ExtendSetup<IN, OUT, CONFIG, EFF>.
It returns a new SignalsFactory of the same type as this SignalsFactory, but with a wrapped SignalsBuild that
extends the code executed in the Signals setup method by the provided code.
SignalsFactory with extended store setupa function extending the setup method of the Signals produced by the SignalsBuild of the resulting SignalsFactory
This method implements the functor-fmap for the SignalsFactory.
It takes as argument a pure function that implements BuildMapper<IN, OUT, CONFIG, EFF, IN2, OUT2, CONFIG2, EFF2>, hence
a function taking SignalsBuild<IN, OUT, CONFIG, EFF> as argument and returning a SignalsBuild<IN2, OUT2, CONFIG2, EFF2>.
The result of fmap is a new SignalsFactory that uses the SignalsBuild<IN2, OUT2, CONFIG2, EFF2> returned
from the mapper.
SignalsFactory<IN2, OUT2, CONFIG2, EFF2>a pure function mapping from SignalsBuild<IN, OUT, CONFIG, EFF> to SignalsBuild<IN2, OUT2, CONFIG2, EFF2>
The mapConfig method takes as argument a pure function that implements MapConfig<CONFIG, CONFIG2>.
It returns a new SignalsFactory<IN, OUT, CONFIG2, EFF>.
SignalsFactory with different Configuration typea pure function mapping CONFIG2 to CONFIG
The mapEffects method takes as argument a pure function that implements MapEffectIds<EFF, EFF2, CONFIG>.
It returns a new SignalsFactory<IN, OUT, CONFIG, EFF2>.
SignalsFactory with different effect-idsa pure function mapping from EFF to EFF2
The mapInput method takes as argument a pure function that implements MapSignalIds<IN, IN2>.
It returns a new SignalsFactory<IN2, OUT, CONFIG, EFF>.
SignalsFactory with different input signalsa pure function mapping from IN to IN2
The mapOutput method takes as argument a pure function that implements MapSignalIds<OUT, OUT2>.
It returns a new SignalsFactory<IN, OUT2, CONFIG, EFF>.
SignalsFactory with different output signalsa pure function mapping from OUT to OUT2
mapOutputBehavior can be used to transfrom an output-behavior of type TOLD to a new behavior of type TNEW,
keeping the output-id-name. Thus, this is a short form for adding a new behavior based on an existing
output-behavior, then removing the ID of the existing one from output and finally, putting the ID of the
new behavior into output under the removed name of the existing behavior.
Hence, this transforms from SignalsFactory<IN, OUT, CONFIG> to SignalsFactory<IN, OUT2, CONFIG>
with OUT2 having the same keys as OUT, but OUT2[KOUT] having type TNEW and OUT[KOUT] having type TOLD
SignalsFactory with a modified output signalvalue-type of the OUT2[KOUT] BehaviorId after mapping
a concrete output key mapping to a BehaviorId<any>
the name of a BehaviorId<any> from OUT
a function returning Observable<TNEW>
removeEffectId can be used as a short alternative to mapEffects, if you want
to remove just a single EffectId from the effect-ids.
SignalsFactory with modified effect-idsa concrete key of the effect-ids of this factory
the name of in NameToEffectIds to be removed
removeInputId can be used as a short alternative to mapInput, if you want
to remove just a single SignalId from the input signal ids.
SignalsFactory with modified input signalsa concrete K of the input signals of this factory
the name of the SignalId to be removed
removeOutputId can be used as a short alternative to mapOutput, if you want
to remove just a single SignalId from the output signal ids.
SignalsFactory with modified output signalsa concrete K of the output signals of this factory
the name of the SignalId to be removed
renameEffectId can be used as a short alternative to mapEffects, if you want
to change the name of a single EffectId in the effect-ids.
SignalsFactory with modified effect-idsa concrete key of EFF
the new name for EFF[K1]
the old key
the new key
renameInputId can be used as a short alternative to mapInput, if you want
to change the name of a single SignalId in the input signal ids.
SignalsFactory with modified input signalsa concrete key of IN
the new name for IN[K1]
the old key
the new key
renameOutputId can be used as a short alternative to mapOutput, if you want
to change the name of a single SignalId in the output signal ids.
SignalsFactory with modified output signalsa concrete key of OUT
the new name for OUT[K1]
the old key
the new key
useExistingEffect can be used to get a factory that uses an existing effect
as the effect referenced by a given effect-id generated by this factory.
SignalsFactory with the concrete type depending on the keepInputId argumenta concrete key of the effect-ids of this factory
a name from this factory's effects, mapping to a concrete EffectId
a function, getting the config as argument and returning the EffectId of an existing effect that should be used for the EffectId specified by K.
specifies whether the resulting SignalsFactory should still produce the EffectId referenced by K.
Generated using TypeDoc
A
SignalsFactorywraps a SignalsBuild function, allowing for simple Signals composition and manipulation. Via thecomposemethod, twoSignalsFactoriescan be easily composed to a new one. Several convenience methods simplify re-mapping ofIN,OUT,CONFIGandEFF. Monadicbindandfmapmethods can be used for more complex cases (though 90% of use-cases should be covered bycompose,extendSetup,mapInput,mapOutputandmapConfig).SignalsFactoryinstances are immutable (persistent data structures), hence all methods return a newSignalsFactoryinstance. (The whole purpose of this class is to provide immutableSignalsBuildcomposition)