context-protocol
Version:
A fully-typed implementation of the context-protocol, with support for subscriptions.
4 lines (3 loc) • 808 B
TypeScript
import type { Context, ContextCallback, ContextType, ExtractContext } from "../../context.ts";
declare const testContextSubscriptions: (createContextFactory: () => <ValueType>(key: unknown) => Context<typeof key, ValueType>, addContextListenerFactory: () => <T>(consumer: EventTarget, context: ExtractContext<T>, callback: ContextCallback<ContextType<T>>, subscribe?: boolean) => void, removeContextListenerFactory: () => <T>(consumer: EventTarget, context: ExtractContext<T>, callback: ContextCallback<ContextType<T>>) => void, setContextValueFactory: () => <T>(consumer: EventTarget, context: ExtractContext<T>, value: ContextType<T>) => void, getContextValueFactory: () => <T>(consumer: EventTarget, context: ExtractContext<T>) => ContextType<T> | undefined) => void;
export { testContextSubscriptions };