create
create<
E,A,I>(factory,onError):Op<I,E,A>
Defined in: Core/Op.ts:487
Creates an Op from an async factory and an error mapper.
The factory receives an AbortSignal and returns a function that takes the input. Capture
the signal in the outer closure and pass it to cancellable APIs like fetch. The error
mapper converts any thrown value into a typed error; it is never called for aborts.
If the factory ignores the signal, cancellation silently stops working: the operation
runs to completion and emits Ok even after the strategy has aborted it. This is harmless
for exclusive and once (which do not abort in-flight work), but causes stale Ok
emissions on restartable, debounced, throttled, buffered, and queue strategies
where in-flight runs are regularly replaced or dropped.
Type Parameters
Section titled “Type Parameters”E
A
I = void
Parameters
Section titled “Parameters”factory
Section titled “factory”(signal) => (input) => Promise<A>
onError
Section titled “onError”(e) => E
Returns
Section titled “Returns”Op<I, E, A>