Hyperlinkv0.8.0-beta.28

Layer

Layer.CurrentMemoMapclasseffect/Layer.ts:567
CurrentMemoMap

Context service for the current MemoMap used in layer construction.

When to use

Use when building custom layer operations that need to access the current memoization map from the fiber context.

Details

This service wraps a MemoMap as a Context.Service, making it available for dependency injection during layer construction.

modelsMemoMap
Source effect/Layer.ts:5676 lines
export class CurrentMemoMap extends Context.Service<CurrentMemoMap, MemoMap>()("effect/Layer/CurrentMemoMap") {
  static forkOrCreate<Services>(self: Context.Context<Services>): MemoMap {
    const current = Context.getOrUndefined(self, CurrentMemoMap)
    return current ? forkMemoMapUnsafe(current) : makeMemoMapUnsafe()
  }
}
Referenced by 5 symbols