I have the following code in an event listener declared in the constructor of a component in my Angular app:
window.addEventListener('keydown, event => {
console.log('key pressed');
});
This fires whenever I press any key while the component exists. The problem is that it fires 6 times instead of once.
What I Want To Know:
1) Why does it fire more than once?
2) How can I make it fire only once?