/**
 * 本模块负责DOM节点变动监听
 * **监听节点变动开销极大，如非必要请改用其他方法并且用后立即销毁！**
 */ /**
 * 本模块负责DOM节点变动监听
 * **监听节点变动开销极大，如非必要请改用其他方法并且用后立即销毁！**
 */ ( function ( ) { const nodelist = [ ] ; param callback returns function observerAddedNodes ( callback ) { try { if ( typeof callback === "function" ) nodelist . push ( callback ) ; return nodelist . length - 1 ; } catch ( e ) { toast . error ( "nodeObserver.js" , e ) ; } } API . observerAddedNodes = ( callback ) => observerAddedNodes ( callback ) ; param id function removeObserver ( id ) { nodelist . splice ( id , 1 ) ; } API . removeObserver = ( id ) => removeObserver ( id ) ; ( new MutationObserver ( d => d . forEach ( d => { d . addedNodes [ 0 ] && nodelist . forEach ( async ( f ) => { try { f ( d . addedNodes [ 0 ] ) ; } catch ( e ) { debug . group ( "nodeObserver.js" ) . error ( e ) . error ( f ) . end ( ) ; } } ) ; } ) ) ) . observe ( document , { childList : true , subtree : true } ) ; } ) ( ) ; declare namespace API { param callback returns function observerAddedNodes ( callback ) ; param id function removeObserver ( id ) ; }