garyb / purescript-virtual-dom

Low level virtual-dom bindings for PureScript
MIT License
30 stars 7 forks source link

Event delegation #9

Open arianvp opened 9 years ago

arianvp commented 9 years ago

Has anyone taken a look at it yet on how to add bindings for them?

garyb commented 9 years ago

When working with virtual-dom in JS usually this is done via ev-* properties in virtual-hyperscript and including dom-delegator to hook them up.

I'm not sure yet what the best approach would be for this library, as there are a few different ways event handlers could work - do they even need to be in Eff for example? (Probably not, I can see how they could work as pure function when using virtual dom, as the effect might take place "elsewhere").

Opinions from anyone out there using or wanting to use the library would be most welcome on this.

fluffynukeit commented 9 years ago

I kind of do not think we need any special event handlers in the virtual-dom library. Handlers can be added using on* attributes or hooks. What those handlers do and how they do it is up to the user or a wrapper library. If someone wants to do things in the virtual-hyperscript way, then they can if they want. In fact, it'd probably be useful to have a set of bindings for virtual-hyperscript to make this easy, but I think it'd be better to have that as a separate library.