Skip to content

Instantly share code, notes, and snippets.

@c7x43t
Last active September 10, 2018 09:16
Show Gist options
  • Save c7x43t/a217542a17db253804dde6e0f3f5e976 to your computer and use it in GitHub Desktop.
Save c7x43t/a217542a17db253804dde6e0f3f5e976 to your computer and use it in GitHub Desktop.
function getEventNames() {
var doc = [];
for (var i in document) {
doc.push(i)
};
doc = doc.filter(function(i) {
var e = document[i];
return i.substring(0, 2) == 'on' && (e == null || e instanceof Function)
})
.map(s => s.replace(/^on/, ""));
var win = [];
for (var i in window) {
win.push(i)
};
win = win.filter(function(i) {
var e = window[i];
return i.substring(0, 2) == 'on' && (e == null || e instanceof Function)
})
.map(s => s.replace(/^on/, ""))
.filter(e => !doc.find(ee => e === ee))
var res = {
document: doc,
window: win
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment