(self: FiberHandle<A, E>)
| 712 | ) |
| 713 | |
| 714 | /** |
| 715 | * Captures the current runtime and returns a function for running effects in |
| 716 | * an existing `FiberHandle` as Promises. |
| 717 | * |
| 718 | * **Details** |
| 719 | * |
| 720 | * Each call stores the forked fiber in the handle and interrupts the previous |
| 721 | * fiber unless `onlyIfMissing` is set. The Promise resolves with the effect's |
| 722 | * success value or rejects with the squashed failure cause. |
| 723 | * |
| 724 | * **Example** (Capturing a runtime for promises) |
| 725 | * |
| 726 | * ```ts import.meta.vitest |
| 727 | * import { Effect, FiberHandle } from "effect" |
| 728 | * |
| 729 | * const program = Effect.gen(function*() { |
| 730 | * const handle = yield* FiberHandle.make() |
| 731 | * const runPromise = yield* FiberHandle.runtimePromise(handle)<never>() |
| 732 | * |
| 733 | * // Run an effect and get a promise |
| 734 | * const promise = runPromise(Effect.succeed("hello")) |
| 735 | * return yield* Effect.promise(() => promise) |
| 736 | * }) |
| 737 | * |
| 738 | * const actual = await Effect.runPromise(Effect.scoped(program)) |
| 739 | * actual // => "hello" |
| 740 | * ``` |
| 741 | * |
| 742 | * @category combinators |
| 743 | * @since 3.13.0 |
| 744 | */ |
| 745 | export const runtimePromise = <A, E>(self: FiberHandle<A, E>): <R = never>() => Effect.Effect< |
| 746 | <XE extends E, XA extends A>( |
| 747 | effect: Effect.Effect<XA, XE, R>, |
| 748 | options?: |
| 749 | | { |
| 750 | readonly signal?: AbortSignal | undefined |
| 751 | readonly scheduler?: Scheduler | undefined |
| 752 | readonly onlyIfMissing?: boolean | undefined |
| 753 | readonly propagateInterruption?: boolean | undefined |
| 754 | } |
| 755 | | undefined |
| 756 | ) => Promise<XA>, |
no test coverage detected
searching dependent graphs…