Runtime overview
Added in v1.0.0
Table of contents
constructors
defaultRuntime
Signature
export declare const defaultRuntime: Runtime<never>
Added in v1.0.0
defaultRuntimeFlags
Signature
export declare const defaultRuntimeFlags: RuntimeFlags.RuntimeFlags
Added in v1.0.0
make
Signature
export declare const make: <R>(options: {
readonly context: Context.Context<R>
readonly runtimeFlags: RuntimeFlags.RuntimeFlags
readonly fiberRefs: FiberRefs.FiberRefs
}) => Runtime<R>
Added in v1.0.0
makeFiberFailure
Signature
export declare const makeFiberFailure: <E>(cause: Cause<E>) => FiberFailure
Added in v1.0.0
execution
runCallback
Executes the effect asynchronously, eventually passing the exit value to the specified callback.
This method is effectful and should only be invoked at the edges of your program.
Signature
export declare const runCallback: <R>(
runtime: Runtime<R>
) => <E, A>(
effect: Effect.Effect<R, E, A>,
onExit?: ((exit: Exit.Exit<E, A>) => void) | undefined
) => (fiberId?: FiberId.FiberId | undefined, onExit?: ((exit: Exit.Exit<E, A>) => void) | undefined) => void
Added in v1.0.0
runFork
Executes the effect using the provided Scheduler or using the global Scheduler if not provided
Signature
export declare const runFork: <R>(
runtime: Runtime<R>
) => <E, A>(self: Effect.Effect<R, E, A>, options?: RunForkOptions | undefined) => Fiber.RuntimeFiber<E, A>
Added in v1.0.0
runPromise
Runs the Effect
, returning a JavaScript Promise
that will be resolved with the value of the effect once the effect has been executed, or will be rejected with the first error or exception throw by the effect.
This method is effectful and should only be used at the edges of your program.
Signature
export declare const runPromise: <R>(runtime: Runtime<R>) => <E, A>(effect: Effect.Effect<R, E, A>) => Promise<A>
Added in v1.0.0
runPromiseExit
Runs the Effect
, returning a JavaScript Promise
that will be resolved with the Exit
state of the effect once the effect has been executed.
This method is effectful and should only be used at the edges of your program.
Signature
export declare const runPromiseExit: <R>(
runtime: Runtime<R>
) => <E, A>(effect: Effect.Effect<R, E, A>) => Promise<Exit.Exit<E, A>>
Added in v1.0.0
runSync
Executes the effect synchronously throwing in case of errors or async boundaries.
This method is effectful and should only be invoked at the edges of your program.
Signature
export declare const runSync: <R>(runtime: Runtime<R>) => <E, A>(effect: Effect.Effect<R, E, A>) => A
Added in v1.0.0
runSyncExit
Executes the effect synchronously returning the exit.
This method is effectful and should only be invoked at the edges of your program.
Signature
export declare const runSyncExit: <R>(runtime: Runtime<R>) => <E, A>(effect: Effect.Effect<R, E, A>) => Exit.Exit<E, A>
Added in v1.0.0
exports
FiberFailureCauseId (type alias)
Signature
export type FiberFailureCauseId = typeof FiberFailureCauseId
Added in v1.0.0
guards
isAsyncFiberException
Signature
export declare const isAsyncFiberException: (u: unknown) => u is AsyncFiberException<unknown, unknown>
Added in v1.0.0
isFiberFailure
Signature
export declare const isFiberFailure: (u: unknown) => u is FiberFailure
Added in v1.0.0
models
AsyncFiberException (interface)
Signature
export interface AsyncFiberException<E, A> {
readonly _tag: 'AsyncFiberException'
readonly fiber: Fiber.RuntimeFiber<E, A>
}
Added in v1.0.0
Cancel (interface)
Signature
export interface Cancel<E, A> {
(fiberId?: FiberId.FiberId, onExit?: (exit: Exit.Exit<E, A>) => void): void
}
Added in v1.0.0
FiberFailure (interface)
Signature
export interface FiberFailure extends Error, Inspectable {
readonly [FiberFailureId]: FiberFailureId
readonly [FiberFailureCauseId]: Cause<unknown>
}
Added in v1.0.0
RunForkOptions (interface)
Signature
export interface RunForkOptions {
scheduler?: Scheduler
updateRefs?: (refs: FiberRefs.FiberRefs, fiberId: FiberId.Runtime) => FiberRefs.FiberRefs
}
Added in v1.0.0
Runtime (interface)
Signature
export interface Runtime<R> extends Pipeable {
/**
* The context used as initial for forks
*/
readonly context: Context.Context<R>
/**
* The runtime flags used as initial for forks
*/
readonly runtimeFlags: RuntimeFlags.RuntimeFlags
/**
* The fiber references used as initial for forks
*/
readonly fiberRefs: FiberRefs.FiberRefs
}
Added in v1.0.0
symbols
FiberFailureCauseId
Signature
export declare const FiberFailureCauseId: typeof FiberFailureCauseId
Added in v1.0.0
FiberFailureId
Signature
export declare const FiberFailureId: typeof FiberFailureId
Added in v1.0.0
FiberFailureId (type alias)
Signature
export type FiberFailureId = typeof FiberFailureId
Added in v1.0.0