Class: Component

browser/components.Component()

Base class for a custom element rendered with lit-html.

Constructor

new Component()

Methods

connectedCallback()

Updates the view after this component is inserted into the DOM.

Called when this component is inserted into the DOM. Override this method to register event listeners. Don't forget to call the super method.

disconnectedCallback()

Currently does nothing.

Called when this component is removed from the DOM. Override this method to remove event listeners. Don't forget to call the super method.

getRenderTarget() → {HTMLElement|DocumentFragment}

Returns the target element of this component to render the view into.

The default is this.

Returns:

The target element.

Type
HTMLElement | DocumentFragment

getView() → {TemplateResult}

Returns the view to render when this component is updated.

The view is a template created with html from lit-html. Override this method to return the view. The default is an empty view.

Returns:

The view.

Type
TemplateResult

updateView()

Updates this component.

Renders the view into the target element.

See: