GWTP:onUnbind()在关闭演示者之后从未调用过

编程入门 行业动态 更新时间:2024-10-23 10:22:20
本文介绍了GWTP:onUnbind()在关闭演示者之后从未调用过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有一个GWTP MyPresenter在onBind()上注册一个处理程序,它的工作原理很好。问题是当我离开演示者使用浏览器上的BACK箭头。 onUnbind()不会被调用(我尝试使用一个断点来覆盖该方法,但是永远不会被执行)。所以这个处理程序永远不会被注册。哪里不对?谢谢。

public class MyPresenter extends PresenterWidget< ViewDiagramPresenter.MyView> { [...] @Override protected void onBind(){ super.onBind(); registerHandler(getEventBus()。addHandler(myEvent.getType(),myHandler)); } }

解决方案

当 Presenter 隐藏时,我记得 onUnBind()不会调用,这将触发 onHide()方法。具体来说,我认为 onUnBind()应该被手动调用 - 你可以例如。如果您覆盖 onHide()。

希望有所帮助。

干杯,

I have a GWTP MyPresenter that registers a handler at onBind(), and it works perfectly. The problem is when I leave the presenter using the BACK arrow on the browser. The onUnbind() is never called (I tried with an breakpoint overriding the method, but is never executed). So that this handler is never unregistered. What is wrong? Thanks.

public class MyPresenter extends PresenterWidget<ViewDiagramPresenter.MyView> { [...] @Override protected void onBind() { super.onBind(); registerHandler(getEventBus().addHandler(myEvent.getType(), myHandler)); } }

解决方案

As I recall onUnBind() is not called when the Presenter is hidden, that would trigger the onHide() method. Specifically, I think the onUnBind() should be called manually - you could eg. chain it if you override onHide().

Hope that helps.

Cheers,

更多推荐

GWTP:onUnbind()在关闭演示者之后从未调用过

本文发布于:2023-10-31 07:28:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1545433.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:演示   GWTP   onUnbind

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!