WebComponent

abstract class WebComponent<E : Element>(observeAttributes: Boolean = true)

Implement this class to build a WebComponent.

Constructors

Link copied to clipboard
constructor(observeAttributes: Boolean = true)

Properties

Link copied to clipboard

a Flow of all changes made to observed attributes.

Functions

Link copied to clipboard
open fun adoptedCallback(element: HTMLElement)

lifecycle-callback that is called, when an instance is adopted by another DOM

Link copied to clipboard

this callback is used, when building the component in native-js (since ES2015-classes are not supported by Kotlin/JS by now)

Link copied to clipboard
fun attributeChanges(name: String): Flow<String>

convenience method to get a Flow of the changes of a specific observed attributes.

Link copied to clipboard
open fun connectedCallback(element: HTMLElement)

lifecycle-callback that is called, when an instance of the component is added to the DOM

Link copied to clipboard

lifecycle-callback that is called, when an instance of the component is removed from the DOM

Link copied to clipboard
abstract fun RenderContext.init(element: HTMLElement, shadowRoot: ShadowRoot): HtmlTag<E>

this method builds the content of the WebComponent that will be added to it's shadow-DOM.

Link copied to clipboard
fun initializeInternal(element: HTMLElement, shadowRoot: ShadowRoot): HtmlTag<E>
Link copied to clipboard
fun linkStylesheet(shadowRoot: ShadowRoot, url: String)

call this method in init to link an external stylesheet.

Link copied to clipboard
fun setStylesheet(shadowRoot: ShadowRoot, text: String)

call this method in add style information from a static String.