basant307/AI_Governance_Project
048
1import window from '../window.mjs';2import debounce from 'lodash/debounce.js';3 4var performance = window ? window.performance : null;5 6var pnow = performance && performance.now ? () => performance.now() : () => Date.now();7 8var raf = (function(){9 if( window ) {10 if( window.requestAnimationFrame ){11 return function( fn ){ window.requestAnimationFrame( fn ); };12 } else if( window.mozRequestAnimationFrame ){13 return function( fn ){ window.mozRequestAnimationFrame( fn ); };14 } else if( window.webkitRequestAnimationFrame ){15 return function( fn ){ window.webkitRequestAnimationFrame( fn ); };16 } else if( window.msRequestAnimationFrame ){17 return function( fn ){ window.msRequestAnimationFrame( fn ); };18 }19 }20 21 return function( fn ){22 if( fn ){23 setTimeout( function(){24 fn( pnow() );25 }, 1000 / 60 );26 }27 };28})();29 30export const requestAnimationFrame = fn => raf( fn );31 32export const performanceNow = pnow;33 34export const now = () => Date.now();35 36export { debounce };37 