diff --git a/src/core/core.animator.js b/src/core/core.animator.js index 1a93e83e71d..287a3b4bb10 100644 --- a/src/core/core.animator.js +++ b/src/core/core.animator.js @@ -1,5 +1,3 @@ -import {requestAnimFrame} from '../helpers/helpers.extras.js'; - /** * @typedef { import('./core.animation.js').default } Animation * @typedef { import('./core.controller.js').default } Chart @@ -41,7 +39,7 @@ export class Animator { } this._running = true; - this._request = requestAnimFrame.call(window, () => { + this._request = requestAnimationFrame(() => { this._update(); this._request = null; diff --git a/src/helpers/helpers.extras.ts b/src/helpers/helpers.extras.ts index 798e10c1e86..0b0acb86194 100644 --- a/src/helpers/helpers.extras.ts +++ b/src/helpers/helpers.extras.ts @@ -8,18 +8,6 @@ export function fontString(pixelSize: number, fontStyle: string, fontFamily: str return fontStyle + ' ' + pixelSize + 'px ' + fontFamily; } -/** -* Request animation polyfill -*/ -export const requestAnimFrame = (function() { - if (typeof window === 'undefined') { - return function(callback) { - return callback(); - }; - } - return window.requestAnimationFrame; -}()); - /** * Throttles calling `fn` once per animation frame * Latest arguments are used on the actual call @@ -36,7 +24,7 @@ export function throttled>( argsToUse = args; if (!ticking) { ticking = true; - requestAnimFrame.call(window, () => { + requestAnimationFrame(() => { ticking = false; fn.apply(thisArg, argsToUse); }); diff --git a/src/platform/platform.basic.js b/src/platform/platform.basic.js index 04e0bee943a..37caa35bafa 100644 --- a/src/platform/platform.basic.js +++ b/src/platform/platform.basic.js @@ -17,7 +17,4 @@ export default class BasicPlatform extends BasePlatform { // https://github.com/chartjs/Chart.js/issues/2807 return item && item.getContext && item.getContext('2d') || null; } - updateConfig(config) { - config.options.animation = false; - } } diff --git a/test/specs/platform.basic.tests.js b/test/specs/platform.basic.tests.js index a2f7a2188d2..16b9699123e 100644 --- a/test/specs/platform.basic.tests.js +++ b/test/specs/platform.basic.tests.js @@ -8,15 +8,6 @@ describe('Platform.basic', function() { chart.destroy(); }); - it('should disable animations', function() { - const chart = acquireChart({type: 'line', options: {animation: {}}}, {useOffscreenCanvas: true}); - - expect(chart.options.animation).toEqual(false); - - chart.destroy(); - }); - - it('supports choosing the BasicPlatform in a web worker', function(done) { const canvas = document.createElement('canvas'); if (!canvas.transferControlToOffscreen) {