/
ai_sampletext
/
DiplomWork
Обзор
Документация
Войти
/
ai_sampletext
/
DiplomWork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
node_modules/react-smooth/es6/setRafTimeout.js
19 строк
583 B
boolyshareyo
Initial commit
08 июн 2026, 16:00
08 июн 2026, 16:00
6216a29
Код
Авторство
О чём код?
function safeRequestAnimationFrame(callback) { if (typeof requestAnimationFrame !== 'undefined') requestAnimationFrame(callback); } export default function setRafTimeout(callback) { var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var currTime = -1; var shouldUpdate = function shouldUpdate(now) { if (currTime < 0) { currTime = now; } if (now - currTime > timeout) { callback(now); currTime = -1; } else { safeRequestAnimationFrame(shouldUpdate); } }; requestAnimationFrame(shouldUpdate); }