in my html, I’ve got an event binding as below:
document.addEventListener('keydown', onKeyDown);
Now that I’d like to hook on the keydown event, i.e., when keydown happens, call another function and trigger the onKeyDown manually.
the document.addEventListener('keydown', onKeyDown); is already there(upstream) and I don’t want to change it. so to sum up:
`keydown` -> `do something` -> `onKeyDown`
Is there a way to achieve this?
If your
onKeyDownmethod could be accessed, you can remove it from event listeners and reattach a modified version: