Nagendra Badiganti
Nagendra Badiganti

Reputation: 2279

Clear the Backbone.history

I am developing phonegap application using backbone Js. To enable the back button functionality i am using Backbone.history.start();.

For one scenario, I want to clear all the application history and invalidating the back button feature.

It would be great if anyone will answer.

Thanks in advance.

Upvotes: 2

Views: 4037

Answers (1)

Puigcerber
Puigcerber

Reputation: 10114

Checking the Backbone source code I see it's possible to disable Backbone.history with Backbone.history.stop(); so this may give you the expected behaviour.

// 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;
},

Upvotes: 4

Related Questions