import { highlight , clear as clearHighlights } from './highlighter' ; import { MessageFactory } from '../../communication' ; import { send } from '../indirect-connection' ; export function onFindElement ( e , tree ) { let foundNode = null ; const findNode = ( node ) => { if ( node . nativeElement ( ) === e . target ) { foundNode = node ; } } ; tree . recurseAll ( findNode ) ; return foundNode ; } export function onElementFound ( node , highlights , buffer ) { if ( node ) { buffer . enqueue ( MessageFactory . foundDOMElement ( node ) ) ; send ( MessageFactory . push ( ) ) ; } if ( highlights ) { clearHighlights ( highlights . map ) ; } }