| 896 | }, |
| 897 | |
| 898 | resultOnce<A, E>(this: Lifetime<any>, atom: Atom.Atom<Result.AsyncResult<A, E>>, options?: { |
| 899 | readonly suspendOnWaiting?: boolean | undefined |
| 900 | }): Effect.Effect<A, E> { |
| 901 | return Effect.callback<A, E>((resume) => { |
| 902 | const result = this.once(atom) |
| 903 | if (result._tag !== "Initial" && !(options?.suspendOnWaiting && result.waiting)) { |
| 904 | return resume(Result.toExit(result) as any) |
| 905 | } |
| 906 | const cancel = this.node.registry.subscribe(atom, (result) => { |
| 907 | if (result._tag === "Initial" || (options?.suspendOnWaiting && result.waiting)) return |
| 908 | cancel() |
| 909 | resume(Result.toExit(result) as any) |
| 910 | }, { immediate: false }) |
| 911 | return Effect.sync(cancel) |
| 912 | }) |
| 913 | }, |
| 914 | |
| 915 | setResult<A, E, W>( |
| 916 | this: Lifetime<any>, |