Script to run parallel to capture key strokes

New to posting and to trying out RPG maker MV. Currently working on my first RPG maker MV game(small but mostly narrative driven). I am almost done with the game but my partner had a question that we might to consider in some future game. Not knowing to much if any of the letter keys are bind to anything, is their a way where if I can script something in JS that runs in the background, where it keeps an eye on keystrokes of the letters. If we have a user that spells out something and it matches the name that is held in a variable we can trigger an event.
Example:
code runs in the background checking keystrokes of letters on a keyboard.
Varible in the code aboves SecretVAR="SAM"
Player is in the middle of a gameplay or an auto event.
Player types SAM on the keyboard(no prompt anywhere just types it)
Code takes that key stroke, saves it in variable called input
If statement
If keystokes varible input=SecretVAR
Do EVENT005

Kinda of a version of the konami code. Hopefully that makes sense.
The first method I can think of:
- turn on Switch 1 at the beginning of the game
- make a parallel process triggered by Switch 1 that checks for letter s then turns off Switch 1 and turns on Switch 2
- make a parallel process triggered by Switch 2 that checks for letter a then turns off Switch 2 and turns on Switch 3. If it detects anything else, turn off Switch 2 and turn on Switch 1.

etc.
Thank you @ATT_Turan. I will give it a try. If it ends up panning out, I'll post some results or if I figure another options, Ill post something.

Have a good day.

Original thread: https://forums.rpgmakerweb.com/threads/script-to-run-parallel-to-capture-key-strokes.145876/