Class LitComponent

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.littemplate.LitTemplate
com.storedobject.helper.LitComponent
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, com.vaadin.flow.internal.Template, Serializable
Direct Known Subclasses:
BrowserMessage, Clock, FlowDiagram, FormSubmit, RedirectSAML, SOChart, Stepper, Template, TimerComponent

public abstract class LitComponent extends com.vaadin.flow.component.littemplate.LitTemplate

This is a simple base component to create a Vaadin component from a LitElement that supports easy execution of Javascript. Normally, execution of Javascript is possible only when the front-end part of the component is attached to the DOM tree and in a ready-state. Vaadin makes sure that the JS commands are executed only when the component is attached. However, there is no guarantee that the component is still in a ready state at that time because of the complexity of the logic in the component.

This class caches all the commands till the front-end is ready to receive commands. The LitElement (client-side) implementation should invoke the server-side ready() method from the connectedCallback() { super.connectedCallback(); this.$server.ready(); } or from any other suitable place when the element is fully ready to receive updates from the server side. If you are using TS instead of JS, please make sure that you cast the "this" as "any" to comply with the strong typing of TS - (this as any).$server.ready();

Since this component is extended from Vaadin's LitTemplate, it has all the features supported by that class too.

Author:
Syam
See Also: