UNPKG

@knighttower/utility

Version:

UtilityJs is a utility library that provides a collection of utility functions for various tasks. The library is designed to be easy to use and covers the most common use cases.

1 lines 714 B
(()=>{"use strict";var e={d:(o,t)=>{for(var n in t){e.o(t,n)&&!e.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:t[n]})}},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)},o={};e.d(o,{domObserver:()=>d});const t={};let n;const d={start:()=>{if("undefined"!=typeof window&&!n){const e={childList:!0,subtree:!0};if(n=new MutationObserver(e=>{for(const o of e){if("childList"===o.type){for(const e in t){t[e]()}}}}),document.body){return n.observe(document.body,e)}document.addEventListener("DOMContentLoaded",o=>n.observe(document.body,e))}},addOnNodeChange:(e,o)=>{o&&(t[e]=o)},removeOnNodeChange:e=>{e&&delete t[e]},cleanup:()=>{Object.keys(t).forEach(e=>delete t[e])}};window.domObserver=o.domObserver})();