You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not an issue but rather a feature discussion.
Very often, listener receive a DOMEvent and in a typical javascript application, we would use e.target to get the target of the event and do things with it. I was thinking that DOMEvent could be made generic, as in DOMEvent<TargetType> to avoid needing casts when using e.target.
This, however, has impact on a big part of the API so I don't know if it is a good solution.
The text was updated successfully, but these errors were encountered:
I believe target is always at least an element:
But there are two other fields for targets relatedTarget and currentTarget. Not sure if they should be of the same type.
By doing TargetType extends ... existing code will not be broken. They'll only get a warning.
Another thing to consider is that maybe Element should receive the target type as generic parameter too so that all the event handlers will have it.
I also think it would not break existing code. One of my concerns is that the types would get more verbose (and it will propagate to all handlers too). Also, as you mentioned, relatedTarget and currentTarget could also be templated (probably with independent types) but we then get very very verbose code...
Templating only "target" looked very convenient at first for me, but it is also quite arbitrary (why this one and not others, ...). I don't know :) Maybe we could have a templated version of the bridge and see which one is easier to use.
This is not an issue but rather a feature discussion.
Very often, listener receive a DOMEvent and in a typical javascript application, we would use e.target to get the target of the event and do things with it. I was thinking that DOMEvent could be made generic, as in DOMEvent<TargetType> to avoid needing casts when using e.target.
This, however, has impact on a big part of the API so I don't know if it is a good solution.
The text was updated successfully, but these errors were encountered: