import { PerformanceLoggerEvent , ProjectorPerformanceLogger } from "../interfaces" ; /**
 * A `ProjectorPerformanceLogger` that reports measurements to window.performance.measure
 *
 * Can be passed to `createProjector` to get more insights into the virtual DOM performance.
 */ export let windowPerformanceProjectorLogger ; if ( ( window as any ) . performance && ( window as any ) . performance . measure ) { let performance = window . performance ; let lastMark ; windowPerformanceProjectorLogger = ( eventType , trigger ) => { performance . mark ( eventType ) ; switch ( eventType ) { case "domEventProcessed" : performance . measure ( "eventHandler" , "domEvent" , "domEventProcessed" ) ; break ; case "renderDone" : performance . measure ( "renderCycle" , "renderStart" , "renderDone" ) ; break ; case "rendered" : performance . measure ( "render" , lastMark , "rendered" ) ; break ; case "patched" : performance . measure ( "diff+patch" , "rendered" , "patched" ) ; break ; } lastMark = eventType ; } ; } else { windowPerformanceProjectorLogger = ( ) => undefined ; }