app.js:9 Uncaught TypeError: Cannot read property 'addEventListeners' of null at app.js:9 code example
Example: Cannot read property 'addEventListener' of null
if (document.body.contains(document.getElementById('someid'))) {
// do what you need
}
// or
if (!document.visibilityState) {
// do what you need
}
// or
if (!document.getElementsByClassName('.someclass')){
// do what you need
}