MCPcopy Create free account
hub / github.com/effect-app/libs / factory

Function factory

repos/effect/packages/effect/src/unstable/reactivity/Atom.ts:728–753  ·  view source on GitHub ↗
(
    create:
      | Layer.Layer<R, E, AtomRegistry | Reactivity.Reactivity>
      | ((get: AtomContext) => Layer.Layer<R, E, AtomRegistry | Reactivity.Reactivity>)
  )

Source from the content-addressed store, hash-verified

726 readonly memoMap: Atom<Layer.MemoMap>
727}
728
729/**
730 * A `RuntimeFactory` backed by a concrete memo map shared across registries.
731 *
732 * @category models
733 * @since 4.0.0
734 */
735export interface SharedRuntimeFactory extends RuntimeFactory {
736 readonly memoMap: Layer.MemoMap
737}
738
739/**
740 * Creates a `RuntimeFactory` backed by a registry-scoped memo map by default,
741 * or by the supplied atom or concrete `Layer.MemoMap`.
742 *
743 * @category constructors
744 * @since 4.0.0
745 */
746export function context(): RegistryRuntimeFactory
747export function context(options: { readonly memoMap: Atom<Layer.MemoMap> }): RegistryRuntimeFactory
748export function context(options: { readonly memoMap: Layer.MemoMap }): SharedRuntimeFactory
749export function context(options?: {
750 readonly memoMap: Atom<Layer.MemoMap> | Layer.MemoMap
751}): RegistryRuntimeFactory | SharedRuntimeFactory {
752 const memoMap = options?.memoMap ?? removeTtl(make(() => Layer.makeMemoMapUnsafe()))
753 const resolveMemoMap = (get: AtomContext): Layer.MemoMap => isAtom(memoMap) ? get(memoMap) : memoMap
754 let globalLayer: Layer.Layer<any, any, AtomRegistry> = Reactivity.layer
755 function factory<E, R>(
756 create:

Callers 1

makeAtomClientRuntimeFunction · 0.85

Calls 4

keepAliveFunction · 0.85
getFunction · 0.70
createFunction · 0.50
effectFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…