Constructs new supply instance.
Optional
receiver: SupplyReceiver<TResult> | SupplyReceiverFn<TResult>Optional supply receiver.
Registers a receiver of this supply.
Once this supply cut off, the receiver
will be informed
on that, unless it is unavailable already.
Does nothing if the given receiver
is unavailable already.
Supply receiver to register.
this
instance.
Makes this and another supply depend on each other.
Calling this method is the same as calling this.needs(another).alsoOff(another)
.
A supply to make this one to mutually depend on.
this
instance.
Creates derived supply depending on this one.
Optional
derived: undefinedNew derived supply instance.
Makes supply receiver depend on this supply.
In contrast to alsoOff method, this one returns derived supply receiver.
Type of supply receiver.
Derived supply receiver to make dependent on this supply.
Derived supply receiver.
Creates derived supply depending on this supply.
If derived supply receiver specified, makes it depend on this supply.
In contrast to alsoOff method, this one returns derived supply receiver.
Type of supply receiver.
Optional derived supply receiver to make dependent on this supply.
Derived supply receiver.
Makes this supply depend on another supplier.
Once the supplier
cuts off the supply, this supply will be cut off with the same reason.
Calling this method has the same effect as calling supplier.alsoOff(this)
.
A supplier to make this supply depend on.
this
instance.
Rest
...reason: ReasonArgs<TResult, TReason>Creates required supply this one depends on.
Optional
required: undefinedNew required supplier.
Makes this supplier require depend on another one.
In contrast to needs method, this one returns required supply.
Type of required supplier.
Optional supplier to make this one depend on.
Required supplier.
Creates required supply this one depends on.
If required supplier specified, makes this one depend on it.
In contrast to needs method, this one returns required supply.
Type of required supplier.
Optional supplier to make this one depend on.
Required supplier.
Builds a promise that will be resolved once this supply is done. This callback will be called immediately if supply is cut off already.
A promise that will be successfully resolved once this supply completes * successfully, or rejected with failure reason.
Registers a supply receiver function that will be called as soon as this supply cut off.
Calling this method is the same as calling this.alsoOff(SupplyReceiver(receiver))
Supply receiver function accepting cut off indicator as its only parameter.
this
instance.
Static
onAssigns unexpected supply failure handler.
When a supply cut off due to some failure, and there is no
supply receiver registered and still available to handle it,
the given handler
will be called with failure indicator as its only parameter.
By default, a warning with unexpected failure reason will be issued to console.
Optional
handler: ((this, reason) => void)A handler to call on unexpected failure, or undefined
to reset to default one.
Static
splitCreates split sides of supply.
Optional
receiver: SupplyReceiver<TResult> | SupplyReceiverFn<TResult>Optional supply receiver.
A tuple containing input and output sides of supply connected to each other.
Generated using TypeDoc
Supply handle.
Represents a supply of something.
The supply can be cut off, and can inform on cutting off.