Open xerial opened 5 months ago
If an RxElement is rendered in a nested sequence, onMount can be called a bit earlier than rendered element actually appears in the browser.
An example:
class HoverableTextLabel(txt: RxElement, hoverMessage: String) extends RxElement: private val elementId = ULID.newULIDString override def onMount: Unit = RxDOM.getHTMLElementById(elementId).foreach { el => try Dynamic.newInstance(Dynamic.global.bootstrap.Tooltip)(el) catch case e: Throwable => warn(e) } override def render: RxElement = span( id -> elementId, data("bs-toggle") -> "tooltip", data("bs-placement") -> "top", data("bs-title") -> hoverMessage, txt ) div( Seq[RxElement]( HoverableTextLabel("hello", "mouseover message") ) )
If an RxElement is rendered in a nested sequence, onMount can be called a bit earlier than rendered element actually appears in the browser.
An example: