我正在使用骨干Js开发phonegap应用程序。要启用后退按钮功能,我使用Backbone.history.start();
。
对于一种情况,我想清除所有应用程序历史记录并使后退按钮功能无效。
如果有人回答,那就太棒了。
提前致谢。
答案 0 :(得分:4)
检查Backbone源代码我看到可以用Backbone.history.stop();
禁用Backbone.history,这样可能会给你预期的行为。
// Disable Backbone.history, perhaps temporarily. Not useful in a real app,
// but possibly useful for unit testing Routers.
stop: function() {
Backbone.$(window).off('popstate', this.checkUrl).off('hashchange', this.checkUrl);
clearInterval(this._checkUrlInterval);
History.started = false;
},