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

Function withScope

packages/platform/src/internal/httpClient.ts:367–380  ·  view source on GitHub ↗
(
  self: Client.HttpClient.With<E, R>
)

Source from the content-addressed store, hash-verified

365
366/** @internal */
367export const withScope = <E, R>(
368 self: Client.HttpClient.With<E, R>
369): Client.HttpClient.With<E, R | Scope.Scope> =>
370 transform(
371 self,
372 (effect, request) => {
373 const controller = new AbortController()
374 scopedRequests.set(request, controller)
375 return Effect.zipRight(
376 Effect.scopeWith((scope) => Scope.addFinalizer(scope, Effect.sync(() => controller.abort()))),
377 effect
378 )
379 }
380 )
381
382export const {
383 /** @internal */

Callers

nothing calls this directly

Calls 4

syncMethod · 0.80
setMethod · 0.65
addFinalizerMethod · 0.65
transformFunction · 0.50

Tested by

no test coverage detected