Skip to content

Instantly share code, notes, and snippets.

@josa42
Created August 10, 2017 07:22
Show Gist options
  • Save josa42/82b87d0bb068f9f629ac61543b4ae765 to your computer and use it in GitHub Desktop.
Save josa42/82b87d0bb068f9f629ac61543b4ae765 to your computer and use it in GitHub Desktop.
deferred-transision
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('one');
this.route('two');
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
willTransition(transition) {
if (this.get('pendingTransition.targetName') == transition.targetName) {
this.set('pendingTransition', null);
return true;
}
console.log(transition)
this.set('pendingTransition', transition);
transition.abort();
Ember.run.later(() => {
transition.retry();
}, 1000);
}
}
});
{{#link-to 'one'}}one{{/link-to}}
{{#link-to 'two'}}two{{/link-to}}
<br>
{{outlet}}
{
"version": "0.12.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment