On load/unload events for DOM elements using a MutationObserver
var onload = require('on-load')
var div = document.createElement('div')
onload(div, function (el) {
console.log('in the dom')
}, function (el) {
console.log('out of the dom')
})
// Will fire the onload
document.body.appendChild(div)
// ... some time later
// Will fire the onunload
document.body.removeChild(div)
(c) 2016 Kyle Robinson Young. MIT License