UNPKG

resize-observer-polyfill

Version:
19 lines (17 loc) 473 B
/** * A shim for requestAnimationFrame which falls back * to setTimeout if the first one is not supported. * * @returns {Number} Requests' identifier. */ export default (() => { if ( window.requestAnimationFrame && typeof window.requestAnimationFrame === 'function' ) { return window.requestAnimationFrame; } return callback => { return setTimeout(() => callback(Date.now()), 1000 / 60); }; })();