MCPcopy Index your code
hub / github.com/Effect-TS/effect / runFork

Function runFork

packages/effect/src/Micro.ts:4214–4235  ·  view source on GitHub ↗
(
  effect: Micro<A, E>,
  options?: {
    readonly signal?: AbortSignal | undefined
    readonly scheduler?: MicroScheduler | undefined
  } | undefined
)

Source from the content-addressed store, hash-verified

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

Callers 15

runtimeFunction · 0.70
runtimePromiseFunction · 0.70
runtimeFunction · 0.70
runtimePromiseFunction · 0.70
runPromiseExitFunction · 0.70
runSyncExitFunction · 0.70
runtimeFunction · 0.70
runtimePromiseFunction · 0.70
onMessageFunction · 0.50
asyncPauseResumeFunction · 0.50
startFunction · 0.50
makeHandlerFunction · 0.50

Calls 6

evaluateMethod · 0.95
unsafeInterruptMethod · 0.95
addObserverMethod · 0.95
addEventListenerMethod · 0.80
removeEventListenerMethod · 0.80
contextMethod · 0.65

Tested by

no test coverage detected