Skip to content

Instantly share code, notes, and snippets.

@bradleypriest
Last active Dec 17, 2015
Embed
What would you like to do?
Ember.KonamiCode
Ember.KonamiCode = Ember.Mixin.create({
konami: [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13],
currentIndex: 0,
keyPress: function(event) {
this._super(event);
var index = this.get('currentIndex');
if (event.keyCode === this.konami[index]) {
if (index === 10) {
this.success();
} else {
this.set('currentIndex', index + 1);
}
} else {
this.set('currentIndex', 0);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment