how to check the listeners on an object js
getEventListeners(domElement)
function listAllEventListeners() {
const allElements = Array.prototype.slice.call(document.querySelectorAll('*'));
allElements.push(document);
allElements.push(window);
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
}
let elements = [];
for (let i = 0; i < allElements.length; i++) {
const currentElement = allElements[i];
for (let j = 0; j < types.length; j++) {
if (typeof currentElement[types[j]] === 'function') {
elements.push({
"node": currentElement,
"type": types[j],
"func": currentElement[types[j]].toString(),
});
}
}
}
return elements.sort(function(a,b) {
return a.type.localeCompare(b.type);
});
}
Also in JavaScript:
- Should I learn Javascript?
- discord bot v12 reaction remove code
- alpine js open outside div
- js replace blogger thumb
- create dynamic fields in react
- get raspberry pi to run node on startup
- Error capturing image. ionic
- textcontent js
- how to call function from another js file in react native
- javascript modify url without reloading page
- check if a word exists in dictionary javascript
- jquery check if clicked outside div
- declare an object in jquery\
- how to select the first div in jQuery
- play audio in javascript
- python turnary
- reference error $ is not defined jquery
- How to send form data from react to express
- react hide source code
- definition destructuring react
- react redirect after login
- colors in node js console
- get screen width javascript
- angular usehash not working