@microsoft/fast-element > ElementController
ElementController class
Controls the lifecycle and rendering of a FASTElement.
Signature:
export declare class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement>
Extends: PropertyChangeNotifier
Implements: HostController<TElement>
Remarks
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ElementController class.
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
|
Map<HostBehavior<TElement>, number> | null |
The behaviors associated with the component. | |
|
|
The context the expression is evaluated against. | ||
|
|
The element definition that instructs this controller in how to handle rendering and other platform integrations. | ||
|
|
boolean |
Indicates whether the element has an existing shadow root (e.g. from declarative shadow DOM). | |
|
|
boolean |
Indicates whether the controller is bound. | |
|
|
boolean |
Indicates whether or not the custom element has been connected to the document. | |
|
ElementStyles | null |
The main set of styles used for the component, independent of any dynamically added styles. | ||
|
|
boolean |
Indicates whether the controller needs to perform initial rendering. | |
|
ShadowRootOptions | undefined |
The shadow root options for the component. | ||
|
|
TElement |
The element being controlled by this controller. | |
|
|
SourceLifetime | undefined |
Indicates how the source's lifetime relates to the controller's lifetime. | |
|
|
The current lifecycle stage of the controller. | ||
|
ElementViewTemplate<TElement> | null |
Gets/sets the template used to render the component. | ||
|
|
ElementView<TElement> | null |
The view associated with the custom element. |
Methods
|
Method |
Modifiers |
Description |
|---|---|---|
|
Adds the behavior to the component. | ||
|
Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot. | ||
|
|
Binds any observables that were set before upgrade. | |
|
Runs connected lifecycle behavior on the associated element. | ||
|
|
Connects any existing behaviors on the associated element. | |
|
Runs disconnected lifecycle behavior on the associated element. | ||
|
|
Disconnects any behaviors on the associated element. | |
|
Emits a custom HTML event. | ||
|
|
Locates or creates a controller for the specified element. | |
|
Runs the attribute changed callback for the associated element. | ||
|
Registers an unbind handler with the controller. | ||
|
Removes the behavior from the component. | ||
|
Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot. | ||
|
|
Renders the provided template to the element. | |
|
|
Sets the strategy that ElementController.forCustomElement uses to construct ElementController instances for an element. |