Files
nofx/web/node_modules/react-smooth/src/setRafTimeout.js
tinkle-community 8d3981fd3e Initial commit: NOFX AI Trading System
- Multi-AI competition mode (Qwen vs DeepSeek)
- Binance Futures integration
- AI self-learning mechanism
- Professional web dashboard
- Complete risk management system
2025-10-28 15:47:34 +08:00

23 lines
496 B
JavaScript

function safeRequestAnimationFrame(callback) {
if (typeof requestAnimationFrame !== 'undefined') requestAnimationFrame(callback);
}
export default function setRafTimeout(callback, timeout = 0) {
let currTime = -1;
const shouldUpdate = now => {
if (currTime < 0) {
currTime = now;
}
if (now - currTime > timeout) {
callback(now);
currTime = -1;
} else {
safeRequestAnimationFrame(shouldUpdate);
}
};
requestAnimationFrame(shouldUpdate);
}