fable-arch icon indicating copy to clipboard operation
fable-arch copied to clipboard

Support VirtualDom widgets

Open fsoikin opened this issue 8 years ago • 0 comments

As Fable.Arch stands today, there is no way to spin up external code, other than hacking around with element IDs and whatnot. No escape hatch. VirtualDom has such escape hatch in the form of Widgets. I propose to add support for them to Fable.Arch's VirtualDom renderer.

I see an API along these lines:

let myView model =
    div [classy "my-component-wrapper"] 
        [Widget {
            init = fun handler -> 
                let element = Browser.document.createElement "div"
                let comp = SuperAwesomeExternalComponent.create element
                comp.onSomeEvent (fun e -> handler e.someData)
                element
            update = fun h e -> 
                null 
        } ]

The implementation seems not complicated at all. I have a working prototype that I can clean up and submit as a PR.

fsoikin avatar Mar 24 '17 22:03 fsoikin