Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Created March 23, 2016 14:03
Show Gist options
  • Save GavinJoyce/1439de8c3ecfbed97bf2 to your computer and use it in GitHub Desktop.
Save GavinJoyce/1439de8c3ecfbed97bf2 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<span style='background-color: yellow;'>Page 1 is a normal route, linking to it works fine. Page 2 does a `transition.abort()` after a 1 second delay. Notice how the `ember-transitioning-in` class isn't removed correctly.</span>
<hr />
<b>UPDATE: this now works with canary:</b>
<hr />
<style>
.active { color: green; }
.ember-transitioning-in { color: red; }
.ember-transitioning-out { color: black; }
</style>
[{{#link-to 'index'}}Home{{/link-to}}]
[{{#link-to 'page1'}}Page 1{{/link-to}}]
[{{#link-to 'page2'}}Page 2{{/link-to}}]
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none'
});
Router.map(function() {
this.route('page1');
this.route('page2');
});
export default Router;
import Ember from 'ember';
var delay = function(milliseconds) {
return new Ember.RSVP.Promise(function(resolve) {
Ember.run.later(this, resolve, milliseconds);
});
};
export default Ember.Route.extend({
beforeModel: function(transition) {
return delay(1000).then(function() {
transition.abort();
});
}
});
import Ember from 'ember';
export default Ember.Route.extend({
});
{
"version": "0.6.5",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "canary",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.0/ember-data.js",
"ember-template-compiler": "canary"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment