We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 91f678d + 71671cf commit 62e1f3cCopy full SHA for 62e1f3c
src/konami.directive.ts
@@ -14,14 +14,16 @@ export class KonamiDirective {
14
15
@HostListener('document:keydown', ['$event'])
16
handleKeyboardEvent(event: KeyboardEvent) {
17
- this.sequence.push(event.keyCode.toString());
+ if (event.keyCode) {
18
+ this.sequence.push(event.keyCode.toString());
19
- if (this.sequence.length > this.konamiCode.length) {
20
- this.sequence.shift();
21
- }
+ if (this.sequence.length > this.konamiCode.length) {
+ this.sequence.shift();
22
+ }
23
- if (this.isKonamiCode()) {
24
- this.konami.emit();
+ if (this.isKonamiCode()) {
25
+ this.konami.emit();
26
27
}
28
29
0 commit comments