onNodeInsert( nodeQuerySelector, callback ) {
	    
        let observer = new MutationObserver( ( mutations, observer ) => {
        
        	for ( let mutation of mutations ) {
        	
        	    for ( let node of mutation.addedNodes ) {
        	    	
        	    	// we track only elements, skip other nodes (e.g. text nodes)
        	    	if ( node.nodeType !== 1 ) { continue; }
        	    	
        	    	if ( node.matches( nodeQuerySelector ) ) {
        	    	    
        	    	    callback( node, mutations, observer );
        	    	    
        	    	    observer.disconnect( );
        	    		
        	    	}
        	
        		}
        	
        	}
        	
        } );
        
        observer.observe( document, { childList: true, subtree: true } );
        
        return observer;
	    
	}
/**
	 * Query selector of node we're looking for
	 */
Query selector of node we're looking for
Query selector of node we ' re looking for
onNodeInsert( nodeQuerySelector, callback ) {
        let observer = new MutationObserver( ( mutations, observer ) => {
        	for ( let mutation of mutations ) {
        	    for ( let node of mutation.addedNodes ) {
        	    	if ( node.nodeType !== 1 ) { continue; }
        	    	if ( node.matches( nodeQuerySelector ) ) {
        	    	    callback( node, mutations, observer );
        	    	    observer.disconnect( );
        	    	}
        		}
        	}
        } );
        observer.observe( document, { childList: true, subtree: true } );
        return observer;
	}
onNodeInsert ( nodeQuerySelector , callback ) { let observer = new MutationObserver ( ( mutations , observer ) => { for ( let mutation of mutations ) { for ( let node of mutation . addedNodes ) { if ( node . nodeType !== 1 ) { continue ; } if ( node . matches ( nodeQuerySelector ) ) { callback ( node , mutations , observer ) ; observer . disconnect ( ) ; } } } } ) ; observer . observe ( document , { childList : true , subtree : true } ) ; return observer ; }
Query selector of node we're looking for
Query selector of node we ' re looking for
// we track only elements, skip other nodes (e.g. text nodes)