A component to recognize the konami code.
The main point was to have some fun with ember-concurrency to see if the entire sequence recognition could be modeled as a single if statement, and lo and behold it worked!
The main component looks like this.
export default Ember.Component.extend({
layout: layout,
match: task(function* () {
if (yield this.up()) {
if (yield this.down()) {
if (yield this.down()) {
if (yield this.left()) {
if (yield this.right()) {
if (yield this.left()) {
if (yield this.right()) {
if (yield this.b()) {
if (yield this.a()) {
if (yield this.b()) {
if (yield this.a()) {
this.sendAction('action');
}
}
}
}
}
}
}
}
}
}
}
}).drop(),
})
fun!
git clone
this repositorynpm install
bower install
ember server
- Visit your app at http://localhost:4200.
npm test
(Runsember try:testall
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit http://ember-cli.com/.