开发者

GWT reflect dynamic event handler

开发者 https://www.devze.com 2023-01-31 08:53 出处:网络
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 el

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号