@microsoft/fast-element/context.js > FASTContext

FASTContext type

A Context object defines an optional initial value for a Context, as well as a name identifier for debugging purposes. The FASTContext can also be used as a decorator to declare context dependencies or as a key for DI.

Signature:

export type FASTContext<T> = ContextDecorator<T> & {
    get(target: EventTarget): T;
    provide(target: EventTarget, value: T): void;
    request(target: EventTarget, callback: ContextCallback<T>, multiple?: boolean): void;
    handle(target: EventTarget, callback: (event: ContextEvent<FASTContext<T>>) => void): void;
};

References: ContextDecorator, ContextCallback, ContextEvent, FASTContext