Skip to content

Instantly share code, notes, and snippets.

@theodorton
Created March 18, 2015 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theodorton/80d075e6f7205d33c01c to your computer and use it in GitHub Desktop.
Save theodorton/80d075e6f7205d33c01c to your computer and use it in GitHub Desktop.
Persisiting routes across tabs in mobile apps
import Ember from 'ember';
import StatefulRoute from 'respoller-app/utils/stateful-route';
export default Ember.Route.extend(StatefulRoute, {
model: function(){
// ...
}
});
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