license import { truncateArray } from "./util" ; const buffer = [ ] ; let bufferStart = 0 ; param fn param a param b param c param d function queueChange < A , B , C , D > ( fn , a , b , c , d ) { buffer . push ( fn ) ; buffer . push ( a ) ; buffer . push ( b ) ; buffer . push ( c ) ; buffer . push ( d ) ; } /**
 * Flushes the changes buffer, calling the functions for each change.
 */ function flush ( ) { const start = bufferStart ; const end = buffer . length ; bufferStart = end ; for ( let i = start ; i < end ; i += 5 ) { const fn = buffer [ i ] as ( a : any , b : any , c : any , d : any ) => undefined ; fn ( buffer [ i + 1 ] , buffer [ i + 2 ] , buffer [ i + 3 ] , buffer [ i + 4 ] ) ; } bufferStart = start ; truncateArray ( buffer , start ) ; } export { queueChange , flush } ;