Skip to main content
Version: 2.x

FASTContext type

@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 declare type FASTContext<T> = ContextDecorator<T> & &#123;
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;
&#125;;

References: ContextDecorator, ContextCallback, ContextEvent, FASTContext