(
effect: Micro<A, E>,
options?: {
readonly signal?: AbortSignal | undefined
readonly scheduler?: MicroScheduler | undefined
} | undefined
)
| 4213 | * @category execution |
| 4214 | */ |
| 4215 | export const runFork = <A, E>( |
| 4216 | effect: Micro<A, E>, |
| 4217 | options?: { |
| 4218 | readonly signal?: AbortSignal | undefined |
| 4219 | readonly scheduler?: MicroScheduler | undefined |
| 4220 | } | undefined |
| 4221 | ): MicroFiberImpl<A, E> => { |
| 4222 | const fiber = new MicroFiberImpl<A, E>(CurrentScheduler.context( |
| 4223 | options?.scheduler ?? new MicroSchedulerDefault() |
| 4224 | )) |
| 4225 | fiber.evaluate(effect as any) |
| 4226 | if (options?.signal) { |
| 4227 | if (options.signal.aborted) { |
| 4228 | fiber.unsafeInterrupt() |
| 4229 | } else { |
| 4230 | const abort = () => fiber.unsafeInterrupt() |
| 4231 | options.signal.addEventListener("abort", abort, { once: true }) |
| 4232 | fiber.addObserver(() => options.signal!.removeEventListener("abort", abort)) |
| 4233 | } |
| 4234 | } |
| 4235 | return fiber |
| 4236 | } |
| 4237 | |
| 4238 | /** |
| 4239 | * Execute the `Micro` effect and return a `Promise` that resolves with the |
no test coverage detected