Context variable
@microsoft/fast-element/context.js > Context
Context variable
Enables using: W3C Community Context protocol.
Signature:
Context: Readonly<{
eventType: "context-request";
for<T = unknown>(name: string): FASTContext<T>;
create<T_1 = unknown>(name: string, initialValue?: T_1 | undefined): FASTContext<T_1>;
setDefaultRequestStrategy(strategy: FASTContextRequestStrategy): void;
get<T_2 extends UnknownContext>(target: EventTarget, context: T_2): ContextType<T_2>;
request<T_3 extends UnknownContext>(target: EventTarget, context: T_3, callback: ContextCallback<ContextType<T_3>>, multiple?: boolean): void;
dispatch<T_4 extends UnknownContext>(target: EventTarget, context: T_4, callback: ContextCallback<ContextType<T_4>>, multiple?: boolean): void;
provide<T_5 extends UnknownContext>(target: EventTarget, context: T_5, value: ContextType<T_5>): void;
handle<T_6 extends UnknownContext>(target: EventTarget, callback: (event: ContextEvent<T_6>) => void, context?: T_6 | undefined): void;
defineProperty<T_7 extends UnknownContext>(target: Constructable<EventTarget> | EventTarget, propertyName: string, context: T_7): void;
}>