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

Function callback

packages/effect/src/Channel.ts:542–549  ·  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

540 * @since 4.0.0
541 */
542export const callback = <A, E = never, R = never>(
543 f: (queue: Queue.Queue<A, E | Cause.Done>) => Effect.Effect<unknown, E, R | Scope.Scope>,
544 options?: {
545 readonly bufferSize?: number | undefined
546 readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
547 }
548): Channel<A, E, void, unknown, unknown, unknown, Exclude<R, Scope.Scope>> =>
549 fromTransform((_, scope) => Effect.map(asyncQueue(scope, f, options), Queue.take))
550
551/**
552 * 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