MCPcopy Create free account
hub / github.com/Effect-TS/effect / callback

Function callback

packages/effect/src/Channel.ts:497–504  ·  view source on GitHub ↗
(
  f: (queue: Queue.Queue<A, E | Cause.Done>) => Effect.Effect<unknown, E, R | Scope.Scope>,
  options?: {
    readonly bufferSize?: number | undefined
    readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
  }
)

Source from the content-addressed store, hash-verified

495 * @since 4.0.0
496 */
497export const callback = <A, E = never, R = never>(
498 f: (queue: Queue.Queue<A, E | Cause.Done>) => Effect.Effect<unknown, E, R | Scope.Scope>,
499 options?: {
500 readonly bufferSize?: number | undefined
501 readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
502 }
503): Channel<A, E, void, unknown, unknown, unknown, Exclude<R, Scope.Scope>> =>
504 fromTransform((_, scope) => Effect.map(asyncQueue(scope, f, options), Queue.take))
505
506/**
507 * Creates a `Channel` that interacts with a callback function using a queue, emitting arrays.

Callers

nothing calls this directly

Calls 3

asyncQueueFunction · 0.85
fromTransformFunction · 0.70
mapMethod · 0.45

Tested by

no test coverage detected