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

Function sliding

packages/effect/src/TxQueue.ts:494–507  ·  view source on GitHub ↗
(
  capacity: number
)

Source from the content-addressed store, hash-verified

492 * @since 2.0.0
493 */
494export const sliding = <A = never, E = never>(
495 capacity: number
496): Effect.Effect<TxQueue<A, E>> =>
497 Effect.gen(function*() {
498 const items = yield* TxChunk.empty<A>()
499 const stateRef = yield* TxRef.make<State<A, E>>({ _tag: "Open" })
500
501 const txQueue = Object.create(TxQueueProto)
502 txQueue.strategy = "sliding"
503 txQueue.capacity = capacity
504 txQueue.items = items
505 txQueue.stateRef = stateRef
506 return txQueue
507 }).pipe(Effect.tx)
508
509// =============================================================================
510// Core Queue Operations

Callers

nothing calls this directly

Calls 2

pipeMethod · 0.65
makeMethod · 0.65

Tested by

no test coverage detected