| Server IP : 138.197.176.125 / Your IP : 216.73.217.54 Web Server : Apache/2.4.41 (Ubuntu) System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/dev.wowchat.co_old/node_modules/react-smooth/src/ |
Upload File : |
import setRafTimeout from './setRafTimeout';
export default function createAnimateManager() {
let currStyle = {};
let handleChange = () => null;
let shouldStop = false;
const setStyle = _style => {
if (shouldStop) {
return;
}
if (Array.isArray(_style)) {
if (!_style.length) {
return;
}
const styles = _style;
const [curr, ...restStyles] = styles;
if (typeof curr === 'number') {
setRafTimeout(setStyle.bind(null, restStyles), curr);
return;
}
setStyle(curr);
setRafTimeout(setStyle.bind(null, restStyles));
return;
}
if (typeof _style === 'object') {
currStyle = _style;
handleChange(currStyle);
}
if (typeof _style === 'function') {
_style();
}
};
return {
stop: () => {
shouldStop = true;
},
start: style => {
shouldStop = false;
setStyle(style);
},
subscribe: _handleChange => {
handleChange = _handleChange;
return () => {
handleChange = () => null;
};
},
};
}