HtmlState

data class HtmlState(val composeViewport: Element = document.body!!, val container: HTMLElement = document.createElement("div") as HTMLDivElement, val content: HTMLElement = document.createElement("div") as HTMLDivElement)

Parameters

composeViewport

The element containing the primary compose viewport. Defaults to document.body.

container

The primary element added to the DOM. All CustomEvents should be dispatched to this element.

content

The content element. This is the node any custom HTML is appended to.

Constructors

Link copied to clipboard
constructor(composeViewport: Element = document.body!!, container: HTMLElement = document.createElement("div") as HTMLDivElement, content: HTMLElement = document.createElement("div") as HTMLDivElement)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns the URL for the runtime JavaScript file. The runtime provides access to the Env variable in any inline JS or included scripts.

Link copied to clipboard

Returns a URL encoded string of the URL for the runtime JavaScript.

Functions

Link copied to clipboard
fun addListener(type: String, listener: (Event) -> Unit)

Add an event listener

Link copied to clipboard
fun emit(event: CustomEvent): Boolean

Send an event from Kotlin to the JS environment

Link copied to clipboard
fun listen(type: String): Flow<CustomEvent>

Listen to events from JS. Cancelling collection will remove the listener in JS.

Link copied to clipboard
fun removeListener(type: String, listener: (Event) -> Unit)

Remove an event listener