UNPKG

@typed/fp

Version:

Data Structures and Resources for fp-ts

36 lines 1.3 kB
/** * Context is an alternative implementation of Ref which is capable of traversing up * in a graph of to find if any ancestors contain the given value. This is allows sharing values * across otherwise isolated environments. * @since 0.11.0 */ import * as E from './Env'; import * as KV from './KV'; import * as Ref from './Ref'; import { SchedulerEnv } from './Scheduler'; /** * Context is an extensions of Ref which traverse up in context to find the closest environment * which contains the expected value. * @since 0.11.0 * @categeory Model */ export interface Context<E, I, O = I> extends Ref.Ref<E, I, O> { } /** * @since 0.11.0 * @category Constructor */ export declare const fromKV: <K, E, A>(kv: KV.KV<K, E, A>) => Context<E & KV.Env & SchedulerEnv, A, A> & KV.KV<K, E, A>; /** * Allows subscribing to the updates ensuring the current KV receives all * updates from an Ancestor. * @since 0.9.2 * @category Combinator */ export declare function useKV<K, E, A>(kv: KV.KV<K, E, A>): E.Env<E & KV.Env & SchedulerEnv, A>; /** * @since 0.13.7 * @category Constructor */ export declare const kv: <E, A, K = symbol>(initial: E.Env<E, A>, options?: KV.Options<K, A> | undefined) => Context<E & KV.Env & SchedulerEnv, A, A> & KV.KV<K, E, A>; //# sourceMappingURL=Context.d.ts.map