Created
March 18, 2015 18:56
-
-
Save theodorton/80d075e6f7205d33c01c to your computer and use it in GitHub Desktop.
Persisiting routes across tabs in mobile apps
This file contains 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
import Ember from 'ember'; | |
import StatefulRoute from 'respoller-app/utils/stateful-route'; | |
export default Ember.Route.extend(StatefulRoute, { | |
model: function(){ | |
// ... | |
} | |
}); |
This file contains 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
import Ember from 'ember'; | |
export default Ember.Mixin.create({ | |
activate: function(){ | |
this._super(); | |
var previousUrl = this.get('_previousUrl'); | |
if (Em.isEmpty(previousUrl)) return; | |
this.set('_previousUrl', null); | |
this.replaceWith(previousUrl); | |
}, | |
actions: { | |
willTransition: function(transition) { | |
this.set('_previousUrl', this.router.get('url')); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment