press
static press = (keyCode, ...args)
Keylogger.press
adds a new action to the private list.
You can add multiple function per call.
Functions from ...args
get e
as event information and info
as information about this actions configs.
Example:
const sayHi = (e, info) => {
var keys = Keylogger.getKeys();
if (keys.incldues(16)) {
console.log(`Hi, you pressed Ctrl and ${e.code}`);
}
}
const someonesSayHi = (e, info) => {
var keys = Keylogger.getKeys();
if (keys.incldues(17)) {
console.log(`Hi, you pressed Shift and ${e.code}`);
}
}
Keylogger.press(32, sayHi, someonesSayHi); // on Ctrl + Space or Shift + Space it will output message
Better avoid spliting actions in multiple functions too much.