GWT reflect dynamic event handler
If i use GWT API to add a dynamic event handler, could i reflect the handler?
For example, I add a handler using: ele.addEventHandler(click, h). Could I u开发者_StackOverflow社区se something like ele.getEventHandler(click), like what we can do in Java?
I didn't test but I think you can't . The reasons :
GWT is java -> javascript compiler. So, every code in client-side should be convertable to javascript. That is why, you can't use java reflection in client-side. Therefore, you should do it in server-side but you can't either. because it is client-side code (javascript code) that works in client not in server. What I mean is button.adClickHandler,addBlurHandler are belong to the client
You could extend ele object class and write your own method getEventHandler(click).
精彩评论