Skip to content

Instantly share code, notes, and snippets.

@foxnewsnetwork
Created May 1, 2019 19:37
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 foxnewsnetwork/bcb8f7a1466ef798ba5ece2be0d55731 to your computer and use it in GitHub Desktop.
Save foxnewsnetwork/bcb8f7a1466ef798ba5ece2be0d55731 to your computer and use it in GitHub Desktop.
Testing-Redirect-Duration-Blank-Ember
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
redirectDuration: Ember.computed("redirectBefore", "transitionStart", {
get() {
return this.get('transitionStart') - this.get('redirectBefore')
}
})
});
import Ember from 'ember';
export default Ember.Component.extend({
tagName: "",
didInsertElement() {
this.get('action')()
}
}).reopenClass({
positionalParams: ['action']
});
import Ember from 'ember';
export default Ember.Route.extend({
beforeModel() {
const controller = this.controllerFor("application")
controller.set("redirectBefore", window.performance.now())
},
model() {
const controller = this.controllerFor("application")
return {
goToPDP: () => {
controller.set("transitionStart", window.performance.now())
this.transitionTo('game.pdp.index')
}
}
}
});
{{did-load this.model.goToPDP}}
{{outlet}}
{{#link-to "index"}}
Back
{{/link-to}}
<h4>Index</h4>
{{outlet}}
<h3>PDP</h3>
{{outlet}}
<h2>Game</h2>
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
const Router = EmberRouter.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('game-redirect')
this.route('game', function() {
this.route('pdp', function() {
})
})
});
export default Router;
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<h2>Redirect Duration: {{this.redirectDuration}}</h2>
{{#link-to "game-redirect"}}
Begin Transition Duration Test
{{/link-to}}
<br>
<br>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": true,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment