我如何确定我是否正在“前进”或“向后”通过我的GWT历史? [英] How do I determine whether I am going "forward" or "backward" through my History in GWT?

查看:147
本文介绍了我如何确定我是否正在“前进”或“向后”通过我的GWT历史?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看历史在GWT中记录JavaDocs ,并且我注意到无法判断向前或向后按钮是按下的(无论是实用还是用户)。 按下按钮由您的注册addValueChangeHandler处理,但唯一传递给处理程序的是历史堆栈中的字符串。没有迹象表明历史记录是向后移动(使用向后箭头按钮)还是向前移动(使用向右箭头按钮)。有没有什么办法可以确定这一点? 解决方案

对不起,你不能。即使可以,也有像Firefox这样的浏览器可以让用户跳回多页。因此,如果您尝试依赖相对坐标而不是绝对,导航可能会破坏您的应用程序。

您可以在历史记录标记上附加某种计数器。如果你只有一个历史监听器,这并不难。


I am looking at History and History JavaDocs in GWT and I notice that there is no way to tell whether the forward or backward button was pressed (either pragmatically or by the user). The "button press" is handled by your registered addValueChangeHandler, but the only thing passed to the handler is a string on your history stack. There is no indication as to whether the "History" is moving "back" (using the back arrow button) or "forward" (using the right arrow button). Is there any way to determine this?

解决方案

Sorry, you can't. And even if you could, there are browsers, like Firefox, that let the user "jump" back more than one page. So if you try to relying on relative "coordinates" instead of absolute, the navigation could break your app.

You can always append some kind of counter on your history token. It would not be hard, if you have only one history listener.

这篇关于我如何确定我是否正在“前进”或“向后”通过我的GWT历史?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆