Package dev.fritz2.dom

Types

CommentNode
Link copied to clipboard
js
class CommentNode(content: String, domNode: Comment) : WithDomNode<Comment>
Represents a DOM-CommentNode
DomLifecycleHandler
Link copied to clipboard
js
typealias DomLifecycleHandler = suspend (WithDomNode<Element>, Any?) -> Unit

Defines type for a handler for lifecycle-events

DomListener
Link copied to clipboard
js
class DomListener<E : Event, out X : Element>(events: Flow<E>) : Listener<E>
Handles a Flow of Dom Events.
EventContext
Link copied to clipboard
js
interface EventContext<out T : Element> : WithJob, WithEvents<T>
Context for handling events
HtmlTagMarker
Link copied to clipboard
js
annotation class HtmlTagMarker
A marker to separate the layers of calls in the type-safe-builder pattern.
Listener
Link copied to clipboard
js
interface Listener<E : Event>
Handles a Flow of Events
MountPoint
Link copied to clipboard
js
interface MountPoint
External interface to access the MountPoint where the lifecycle of Tags and subtrees is handled.
Tag
Link copied to clipboard
js
open class Tag<out E : Element>(tagName: String, id: String?, baseClass: String?, job: Job, scope: Scope) : WithDomNode<E> , WithComment<E> , EventContext<E> , RenderContext
Represents a tag in the resulting HTML.
TextNode
Link copied to clipboard
js
class TextNode(content: String, domNode: Text) : WithDomNode<Text>
Represents a DOM-TextNode
Window
Link copied to clipboard
js
object Window
Represents all Events of the browser window object as WindowListeners
WindowListener
Link copied to clipboard
js
class WindowListener<E : Event>(events: Flow<E>) : Listener<E>
Handles a Flow of Window Events
WithComment
Link copied to clipboard
js
interface WithComment<out N : Node> : WithDomNode<N>
Provides functionality to handle comments.
WithDomNode
Link copied to clipboard
js
external interface WithDomNode<out N : Node>
Base-interface for everything that represents a node in the DOM.
WithEvents
Link copied to clipboard
js
interface WithEvents<out T : Element> : WithDomNode<T>
Offers DomListeners for all DOM-events available.
WithText
Link copied to clipboard
js
interface WithText<N : Node> : WithDomNode<N> , RenderContext
Interface providing functionality to handle text-content

Functions

afterMount
Link copied to clipboard
js
fun <T : Element> Tag<T>.afterMount(payload: Any? = null, handler: DomLifecycleHandler)
Convenience method to register lifecycle handler for after a Tag is mounted
beforeUnmount
Link copied to clipboard
js
fun <T : Element> Tag<T>.beforeUnmount(payload: Any? = null, handler: DomLifecycleHandler)
Convenience method to register lifecycle handler for before a Tag is unmounted
delete
Link copied to clipboard
js
suspend fun <N : Node> N.delete(start: Int, count: Int, parentJob: Job, cancelJob: suspend (Node) -> Unit)
Deletes elements from the DOM.
enter
Link copied to clipboard
js
fun DomListener<KeyboardEvent, HTMLInputElement>.enter(): Flow<String>
Gives you the new value as String from the targeting Element when enter is pressed.
fun DomListener<KeyboardEvent, HTMLTextAreaElement>.enter(): Flow<String>
Gives you the new value as String from the targeting Element.
enterAsNumber
Link copied to clipboard
js
fun DomListener<KeyboardEvent, HTMLInputElement>.enterAsNumber(): Flow<Double>
Gives you the new value as Double from the targeting Element when enter is pressed.
files
Link copied to clipboard
js
fun DomListener<Event, HTMLInputElement>.files(): Flow<FileList?>
Gives you the FileList from the targeting Element.
insert
Link copied to clipboard
js
fun <N : Node> N.insert(element: WithDomNode<N>, index: Int)
Inserts or appends elements to the DOM.
insertMany
Link copied to clipboard
js
fun <N : Node> N.insertMany(elements: List<WithDomNode<N>>, index: Int)
Inserts a List of elements to the DOM.
key
Link copied to clipboard
js
fun <X : Element> DomListener<KeyboardEvent, X>.key(): Flow<Shortcut>
Gives you the pressed key as Shortcut from a KeyboardEvent.
fun WindowListener<KeyboardEvent>.key(): Flow<Shortcut>
Gives you the pressed key as Shortcut from a KeyboardEvent.
merge
Link copied to clipboard
js
fun merge(vararg listener: DomListener<*, *>): Flow<Unit>
Merges multiple DomListener like the analog method on Flows
mountPoint
Link copied to clipboard
js
fun Tag<*>.mountPoint(): MountPoint?
Allows to access the nearest MountPoint from any Tag
move
Link copied to clipboard
js
fun <N : Node> N.move(from: Int, to: Int)
Moves elements from on place to another in the DOM.
selectedIndex
Link copied to clipboard
js
fun DomListener<Event, HTMLSelectElement>.selectedIndex(): Flow<Int>
Gives you the selected index as Int from the targeting Element.
selectedText
Link copied to clipboard
js
fun DomListener<Event, HTMLSelectElement>.selectedText(): Flow<String>
Gives you the selected text as String from the targeting Element.
selectedValue
Link copied to clipboard
js
fun DomListener<Event, HTMLSelectElement>.selectedValue(): Flow<String>
Gives you the selected value as String from the targeting Element.
states
Link copied to clipboard
js
fun DomListener<Event, HTMLInputElement>.states(): Flow<Boolean>
Gives you the checked value as Boolean from the targeting Element.
values
Link copied to clipboard
js
fun DomListener<Event, HTMLFieldSetElement>.values(): Flow<String>
Gives you the new value as String from the targeting Element.
fun DomListener<Event, HTMLInputElement>.values(): Flow<String>
Gives you the new value as String from the targeting Element.
fun DomListener<Event, HTMLSelectElement>.values(): Flow<String>
Gives you the new value as String from the targeting Element.
fun DomListener<Event, HTMLTextAreaElement>.values(): Flow<String>
Gives you the new value as String from the targeting Element.
fun DomListener<InputEvent, HTMLInputElement>.values(): Flow<String>
Gives you the new value as String from the targeting Element.
valuesAsNumber
Link copied to clipboard
js
fun DomListener<Event, HTMLInputElement>.valuesAsNumber(): Flow<Double>
Gives you the new value as Double from the targeting Element.
fun DomListener<InputEvent, HTMLInputElement>.valuesAsNumber(): Flow<Double>
Gives you the new value as Double from the targeting Element.