I have a program which runs just fine in the console, because I paste it into the browser console. It uses the console's function getEventListeners
which is very handy to get the handlers for specific events. However, I would like to do this for a regular javascript (without console). For example, in the console the code looks like this:
someEl.addEventListener('mousedown', () => { alert('mousedown') });
const mouseDownHandler = getEventListeners(someEl).mousedown[0].listener;
How can I do the same thing without the console? Any help would be appreciated!