1// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2// for details on configuring this project to bundle and minify static web assets. 3 4// Write your JavaScript code. 5const konami = () => { 6 var pattern = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a']; 7 var current = 0; 8 9 var keyHandler = function (event) { 10 11 // If the key isn't in the pattern, or isn't the current key in the pattern, reset 12 if (pattern.indexOf(event.key) < 0 || event.key !== pattern[current]) { 13 current = 0; 14 return; 15 } 16 17 // Update how much of the pattern is complete 18 current++; 19 20 // If complete, alert and reset 21 if (pattern.length === current) { 22 current = 0; 23 document.dispatchEvent(new CustomEvent('konamiCodeEntered', { bubbles: true })) 24 } 25 26 }; 27 28 // Listen for keydown events 29 document.addEventListener('keydown', keyHandler, false); 30}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.