MCPcopy
hub / github.com/Effect-TS/effect / promise

Function promise

packages/effect/src/Micro.ts:1063–1069  ·  view source on GitHub ↗
(evaluate: (signal: AbortSignal) => PromiseLike<A>)

Source from the content-addressed store, hash-verified

1061 * @category constructors
1062 */
1063export const promise = <A>(evaluate: (signal: AbortSignal) => PromiseLike<A>): Micro<A> =>
1064 asyncOptions<A>(function(resume, signal) {
1065 evaluate(signal!).then(
1066 (a) => resume(succeed(a)),
1067 (e) => resume(die(e))
1068 )
1069 }, evaluate.length !== 0)
1070
1071/**
1072 * Wrap a `Promise` into a `Micro` effect. Any errors will be caught and

Callers

nothing calls this directly

Calls 3

resumeFunction · 0.70
dieFunction · 0.70
succeedFunction · 0.50

Tested by

no test coverage detected