Skip to main content
Version: 2.x

ContextEvent class

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

ContextEvent class

An event fired by a context requester to signal it desires a named context.

A provider should inspect the context property of the event to determine if it has a value that can satisfy the request, calling the callback with the requested value if so.

If the requested context event contains a truthy multiple value, then a provider can call the callback multiple times if the value is changed, if this is the case the provider should pass a dispose method to the callback which requesters can invoke to indicate they no longer wish to receive these updates.

Signature:

export declare class ContextEvent<T extends UnknownContext> extends Event 

Extends: Event

Constructors

Constructor

Modifiers

Description

(constructor)(context, callback, multiple)

Constructs a new instance of the ContextEvent class

Properties

Property

Modifiers

Type

Description

callback

readonly

ContextCallback<ContextType<T>>

context

readonly

T

multiple?

readonly

boolean | undefined

(Optional)