I think it could be improved a bit more, for example there are a few more places where requestAnimationFrame is being used, as well as cancelAnimationFrame which may have similar issues.
It could be a good idea to do a one-time check in the beginning, e.g. in the top of the file, check if requestAnimationFrame is a function. If not, try to get a shim for it. Speaking of shims, I remembered the raf package.
Can you please check how that package could be used and update the PR? I can provide hints if you get stuck :)
Thanks for the PR! ❤️
I think it could be improved a bit more, for example there are a few more places where
requestAnimationFrame
is being used, as well ascancelAnimationFrame
which may have similar issues.It could be a good idea to do a one-time check in the beginning, e.g. in the top of the file, check if requestAnimationFrame is a function. If not, try to get a shim for it. Speaking of shims, I remembered the raf package.
Can you please check how that package could be used and update the PR? I can provide hints if you get stuck :)