dominikh / go-js-dom

MIT License
252 stars 42 forks source link

Get underlying *js.Object from Event #31

Closed vron closed 8 years ago

vron commented 8 years ago

Hi,

First of all, thanks for a great library.

I often find my self needing the underlying *js.Object from an event (to add state information and retrieve the corresponding information if other handlers for the same event). As is the the event interface does not allow me to do this in a type safe way since I do not know the concrete type of the event (may be one f several) I in each function needs to have a large type switch which effectively tests all the event types (and what if more are added, that would lead to a panic/not working).

Thus, my uggestion would be to add a:

Underlying() *js.Object

method to the Event interface.

Any thoughts?

dominikh commented 8 years ago

Sounds like a good idea, done.

vron commented 8 years ago

Thanks!