]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Remove `for of` loops for IE compatibility (#6905)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Sat, 4 Jan 2020 17:59:27 +0000 (19:59 +0200)
committerEvert Timberg <evert.timberg+github@gmail.com>
Sat, 4 Jan 2020 17:59:27 +0000 (12:59 -0500)
src/core/core.animations.js
src/core/core.animator.js

index 220cbc303ac56beda91011d131873d54649d2acb..c592b6a9ac70b8413025a36a9c633a369be612f0 100644 (file)
@@ -71,7 +71,7 @@ export default class Animations {
                        if (!isObject(cfg)) {
                                return;
                        }
-                       for (let prop of cfg.properties || [key]) {
+                       (cfg.properties || [key]).forEach(function(prop) {
                                // Can have only one config per animation.
                                if (!animatedProps.has(prop)) {
                                        animatedProps.set(prop, extend({}, animDefaults, cfg));
@@ -79,7 +79,7 @@ export default class Animations {
                                        // Single property targetting config wins over multi-targetting.
                                        animatedProps.set(prop, extend({}, animatedProps.get(prop), cfg));
                                }
-                       }
+                       });
                });
        }
 
index 29422d5ba85b1c219570e39ded0b116e03e4097e..e6e5a60cfeb7c8befd85552c9bb27c8dcda571d6 100644 (file)
@@ -64,12 +64,11 @@ class Animator {
        _update() {
                const me = this;
                const date = Date.now();
-               const charts = me._charts;
                let remaining = 0;
 
-               for (let [chart, anims] of charts) {
+               me._charts.forEach(function(anims, chart) {
                        if (!anims.running || !anims.items.length) {
-                               continue;
+                               return;
                        }
                        const items = anims.items;
                        let i = items.length - 1;
@@ -105,12 +104,12 @@ class Animator {
                        }
 
                        remaining += items.length;
-               }
+               });
 
-               this._lastDate = date;
+               me._lastDate = date;
 
                if (remaining === 0) {
-                       this._running = false;
+                       me._running = false;
                }
        }