解决方案
当 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()在关闭演示者之后从未调用过
发布评论