Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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/39520fdfa5fb12a924380ec31d509f02 to your computer and use it in GitHub Desktop.
Save foxnewsnetwork/39520fdfa5fb12a924380ec31d509f02 to your computer and use it in GitHub Desktop.
Alternative-Proposal-to-TTI-Measurement
<h2>
browse/collection/index/template.hbs
</h2>
{{outlet}}
<h2>
browse/collection/template.hbs
</h2>
{{outlet}}
<h2>
browse/template.hbs
</h2>
{{outlet}}
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Component.extend({
tagName: '',
didInsertElement() {
this.action()
}
}).reopenClass({
positionalParams: ['action']
});
<h2>
game/pdp/index/template.hbs
</h2>
{{outlet}}
<h2>
game/pdp/template.hbs
</h2>
{{outlet}}
<h2>
game/preplay/index/template.hbs
</h2>
{{outlet}}
<h2>
game/preplay/launch/template.hbs
</h2>
{{outlet}}
<h2>
game/preplay/template.hbs
</h2>
{{outlet}}
<h2>
game/template.hbs
</h2>
{{outlet}}
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', function() {
this.route('preplay', function() {
this.route('launch')
})
this.route('pdp', function() {
this.route('gallery')
})
})
this.route('browse', function() {
this.route('collection', function() {
})
})
});
export default Router;
import Ember from 'ember';
function* product(setA, setB) {
for(const a of setA) {
for(const b of setB) {
yield [a, b]
}
}
}
function* map(itA, fn) {
for(const a of itA) {
yield fn(a)
}
}
export default Ember.Service.extend({
init() {
this.starts = new Set()
this.finishes = new Set()
},
start(name) {
const start = { name, time: performance.now() }
this.starts.add(start)
return () => {
this.starts.remove(start)
}
},
finish(name) {
const finish = { name, time: performance.now() }
this.finishes.add(finish)
return () => {
this.finishes.remove(finish)
}
},
reportAll(cb) {
const _a = product(this.start, this.finish)
const _b = map(_a, ([start, finish]) => ({
name: `${start.name}-->${finish.name}`,
duration: finish.time - start.time
}))
cb(_b)
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
import Ember from 'ember';
import { inject as service } from '@ember/service';
export default Ember.Component.extend({
tagName: '',
tti: service('tti'),
actions: {
register(tti, name) {
tti.finish(name)
}
}
}).reopenClass({
positionalParams: ['locationName']
});
{{did-load (action 'register' tti @locationName)}}
{{yield}}
import Ember from 'ember';
import { inject as service } from '@ember/service';
export default Ember.Component.extend({
tagName: '',
tti: service('tti'),
actions: {
register(tti, name) {
tti.start(name)
}
}
}).reopenClass({
positionalParams: ['locationName']
});
{{will-destroy (action 'register' tti @locationName)}}
{{yield}}
{
"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"
}
}
import Ember from 'ember';
export default Ember.Component.extend({
tagName: '',
willDestroyElement() {
this.action()
}
}).reopenClass({
positionalParams: ['action']
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment