Created
May 8, 2019 00:06
-
-
Save foxnewsnetwork/39520fdfa5fb12a924380ec31d509f02 to your computer and use it in GitHub Desktop.
Alternative-Proposal-to-TTI-Measurement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
tagName: '', | |
didInsertElement() { | |
this.action() | |
} | |
}).reopenClass({ | |
positionalParams: ['action'] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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