Closed AngelMunoz closed 2 years ago
Yes, we should add a helper to dispatch custom events, thanks for the reminder :+1: And we should also make it easier to get a reference to the this
instance. Maybe returning it together with the props in the LitElement.init
function?
About fable-browser, right now is what we call a "pure binding" meaning the package only contains metadata and no actual code. So we only need to reference the .dll so the F#/Fable compiler doesn't need to parse the sources. Because of this, it's better not to add helpers for now. Having them in Fable.Lit should work 👍
I think we're missing an integral part of Lit I don't remember adding (and it flew over my head sorry) anythign related to dispatching events from the LitElement
in F# we would need to do something like this
Which I guess it's fine, but the target of the event won't be the web component itself (as in Lit) but the button that is dispatching the event
I think if we add a helper function in the LitElement class defined here
could fix the dispatch target.
The creation of events can be worked in the fable-browser repo because I think we've (mostly I, plead guilty) been recently adding helpers in many of the samples and I think that should belong there to be honest 😀
Reference: https://lit.dev/docs/components/events/#dispatching-events