Skip to content

Bolero 0.1.89

Pre-release
Pre-release
Compare
Choose a tag to compare
@Tarmil Tarmil released this 22 Jan 20:54
· 553 commits to master since this release

Features

#13: Add DOM element reference functions.

  • attr.ref : (ElementRef -> unit) -> Attr calls the given function with a reference to the element when it is inserted.

  • attr.bindRef : ElementRefBinder -> Attr binds the element when it is inserted. The ElementRefBinder is typically created as a component field using ElementRefBinder() and used in event handlers through its .ref property, of type ElementRef.

type View() =
    inherit ElmishComponent<Model, Message>()

    let buttonRef = ElementRefBinder()

    override this.View model dispatch =
        button [
            attr.bindRef buttonRef
            on.click (fun _ -> someJsCallback(buttonRef.ref))
        ] [text "Click me!"]