Skip to main content
100%

Related to https://twitter.com/timferro/status/705189339890843648 - notify when the user types in a certain word / sequence of chars

✓ Published0🌍 Public
Aalessioalex
Last edited Mar 7, 2016
Created on Mar 7, 2016

This example demonstrates a keyboard shortcut detector that triggers a callback when a user types a specific sequence of characters—here, the name “alexandru.” It shows how a browser can monitor keypresses in real time and react to a predefined pattern. The code uses a plain JavaScript `keydown` event listener on the document, storing key codes in an array and comparing the last entered keys against the target sequence. When the sequence matches, the callback logs a message to the console. No external libraries are used; the implementation relies solely on native DOM event handling.

AI-generated description

Similar vizzes