UNPKG

3d-tiles-renderer

Version:

https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification

24 lines (14 loc) 405 B
import { Scheduler } from './Scheduler.js'; // function that rate limits the amount of time a function can be called to once // per frame, initially queuing a new call for the next frame. export function throttle( callback ) { let handle = null; return () => { if ( handle === null ) { handle = Scheduler.requestAnimationFrame( () => { handle = null; callback(); } ); } }; }