Skip to content

Instantly share code, notes, and snippets.

@machty
Created May 13, 2013 16:00
Show Gist options
  • Select an option

  • Save machty/5569408 to your computer and use it in GitHub Desktop.

Select an option

Save machty/5569408 to your computer and use it in GitHub Desktop.
Modification to Ember.Router to allow transitions to be rememberable/refirable
// Modification to Ember Router to enable rememberable transitions.
function rememberAndPerformTransition() {
var args = [].slice.call(arguments), self = this, _super = this._super;
this.currentTransition = function() {
_super.apply(self, args);
};
this.currentTransition();
}
App.Router.reopen({
transitionTo: rememberAndPerformTransition,
handleURL: rememberAndPerformTransition,
saveTransition: function() {
this.savedTransition = this.savedTransition || this.currentTransition;
},
retryTransition: function() {
if (this.savedTransition) {
this.savedTransition();
this.savedTransition = null;
return true;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment