@tempots/dom

OnElement() function

Executes a callback function when the parent element is mounted in the DOM. The given function can return a TNode or void. Any returned TNode will be appended to the element argument. If you need to perform some actions when the Renderable is disposed, you can use OnDispose as the return value.

Signature:

OnElement: <T extends HTMLElement>(fn: (element: T) => TNode | void) => Renderable

Parameters

Parameter

Type

Description

fn

(element: T) => TNode | void

The callback function to be executed.

Returns: Renderable

  • The renderable function.