Function
run
(
effect: Effect.Effect<A, VerificationError>,
signal: AbortSignal,
onSuccess: (value: A) => void,
)
Source from the content-addressed store, hash-verified
| 82 | const codeId = useId(); |
| 83 | |
| 84 | const run = async <A,>( |
| 85 | effect: Effect.Effect<A, VerificationError>, |
| 86 | signal: AbortSignal, |
| 87 | onSuccess: (value: A) => void, |
| 88 | ) => { |
| 89 | const exit = await Effect.runPromiseExit(effect, { signal }); |
| 90 | if (signal.aborted) return; |
| 91 | if (Exit.isSuccess(exit)) onSuccess(exit.value); |
| 92 | else setError(Option.getOrNull(Cause.findErrorOption(exit.cause))?.message ?? unavailable); |
| 93 | }; |
| 94 | |
| 95 | useEffect(() => { |
| 96 | const owner = new AbortController(); |
Tested by
no test coverage detected