on-load
On load/unload events for DOM elements using a MutationObserver
usage
var onload = var div = document // Will fire the onloaddocumentbody // ... some time later // Will fire the onunloaddocumentbody
API
onload(node, onloadFn, onunloadFn, [caller])
Pass a dom node
to onload
to have a onloadFn
function fire when the dom node
is added to the document dom
and a onunloadFn
fire when the dom node
is removed from the document dom
. Optionally a caller
ID can be set to associate the onload/onunload hooks with a particular instance of of a dom node
. This is commonly used when 'componentizing' dom nodes.
license
(c) 2018 Kyle Robinson Young. MIT License