Created
May 13, 2013 16:00
-
-
Save machty/5569408 to your computer and use it in GitHub Desktop.
Modification to Ember.Router to allow transitions to be rememberable/refirable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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