Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requestAnimationFrame() polyfill does get applied for dedicated workers for no reason #11891

Open
tobiu opened this issue Aug 31, 2024 · 0 comments

Comments

@tobiu
Copy link

tobiu commented Aug 31, 2024

Expected behavior

a dedicated worker has full support for requestAnimationFrame()
https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/requestAnimationFrame

/**
* Request animation polyfill
*/
export const requestAnimFrame = (function() {
  if (typeof window === 'undefined') {
    return function(callback) {
      return callback();
    };
  }
  return window.requestAnimationFrame;
}());

so this will get applied, which is not good.

what you want to check instead:

if (!globalThis.requestAnimationFrame) {
   // smart polyfill
}

Current behavior

polyfill getting applied in dedicated workers

Reproducible sample

https://github.com/neomjs/chartjs-demo

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

No response

chart.js version

v4.4.4

Browser name and version

No response

Link to your project

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant