import type { AnyToVoidFnSignature } from '../misc/functions' ; /**
 * Postpone action after next render
 */ export const afterNextRender = ( callback ) : number => requestAnimationFrame ( ( ) => requestAnimationFrame ( callback ) ) ; returns export const rafDecorator = < T extends AnyToVoidFnSignature > ( fn ) : T => { let lastArgs = null ; return function ( ... args ) { if ( lastArgs === null ) { requestAnimationFrame ( ( ) => { lastArgs && fn . call ( this , ... lastArgs ) ; lastArgs = null ; } ) ; } lastArgs = args ; } as T ; } ;