list listener on a page js
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:
- jquery loop through array
- lodash find object in array
- three js get size of object
- short string javascript
- how to copy one array to another in javascript
- javascript percent to int
- laravel send http post request json
- vector swizzling in javascript
- React import image with url
- vscode angular: running ngcc
- jquery chrome extension
- get current scroll height javascript
- electron send message from renderer to main
- mongoose find and update prop
- get location from brwoser react
- How to add a property at the middle of an object in javascript
- client side redirect javascript
- gatsbyjs image sharp
- pause console debugger in react
- typescript filter array of null
- how sent data to dilaog angular material
- bullmq
- nombre random js
- generate random character in javascript