From fa022ca20c20e424b51838ec3ab5c0e21165f42c Mon Sep 17 00:00:00 2001 From: yangzhang Date: Fri, 20 Sep 2019 14:16:19 +0800 Subject: [PATCH] fix: replace performance.now to Date.now so as to compatible with ios8. --- number-flip.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/number-flip.js b/number-flip.js index 1cb0df0..ccd6d02 100644 --- a/number-flip.js +++ b/number-flip.js @@ -120,10 +120,10 @@ export class Flip { temp *= 10 } } - const start = performance.now() + const start = Date.now() const dur = (duration * 1000) || this.duration - const tick = now => { - let elapsed = now - start + const tick = () => { + let elapsed = Date.now() - start draw(elapsed / dur) if (elapsed < dur) requestAnimationFrame(tick) else {