Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/core/core.animator.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -41,7 +39,7 @@ export class Animator {
}
this._running = true;

this._request = requestAnimFrame.call(window, () => {
this._request = requestAnimationFrame(() => {
this._update();
this._request = null;

Expand Down
14 changes: 1 addition & 13 deletions src/helpers/helpers.extras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,7 +24,7 @@ export function throttled<TArgs extends Array<any>>(
argsToUse = args;
if (!ticking) {
ticking = true;
requestAnimFrame.call(window, () => {
requestAnimationFrame(() => {
ticking = false;
fn.apply(thisArg, argsToUse);
});
Expand Down
3 changes: 0 additions & 3 deletions src/platform/platform.basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
9 changes: 0 additions & 9 deletions test/specs/platform.basic.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down