2
我正在開發使用骨幹Js的phonegap應用程序。要啓用後退按鈕功能,我正在使用Backbone.history.start();
。清除Backbone.history
對於一種情況,我想清除所有應用程序歷史記錄並使後退按鈕功能無效。
這將是偉大的,如果有人會回答。
在此先感謝。
我正在開發使用骨幹Js的phonegap應用程序。要啓用後退按鈕功能,我正在使用Backbone.history.start();
。清除Backbone.history
對於一種情況,我想清除所有應用程序歷史記錄並使後退按鈕功能無效。
這將是偉大的,如果有人會回答。
在此先感謝。
檢查主幹源代碼我發現可以用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;
},
謝謝Puigcerber。 –
不客氣@nagendra。現在如果問題解決了,你應該接受答案。乾杯。 – Puigcerber
其實我正在開發使用Phonegap和主幹的Android Web應用程序。 如果我使用你的函數清除或禁用Backbone.history,我的應用程序停止與其他功能一起工作。 :(:( –