From 2cfbef476c09ce1823343379b43ed53a677cc97a Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 4 Apr 2024 23:15:07 -0400 Subject: [PATCH] update test helper --- packages/svelte/tests/animation-helpers.js | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/packages/svelte/tests/animation-helpers.js b/packages/svelte/tests/animation-helpers.js index 8244081332..79953d5c8f 100644 --- a/packages/svelte/tests/animation-helpers.js +++ b/packages/svelte/tests/animation-helpers.js @@ -38,8 +38,7 @@ class Animation { #offset = raf.time; - #finished = () => {}; - #cancelled = () => {}; + onfinish = () => {}; currentTime = 0; startTime = 0; @@ -54,21 +53,6 @@ class Animation { this.#keyframes = keyframes; this.#duration = duration; - // Promise-like semantics, but call callbacks immediately on raf.tick - this.finished = { - /** @param {() => void} callback */ - then: (callback) => { - this.#finished = callback; - - return { - /** @param {() => void} callback */ - catch: (callback) => { - this.#cancelled = callback; - } - }; - } - }; - this._update(); } @@ -78,7 +62,7 @@ class Animation { this.#apply_keyframe(target_frame); if (this.currentTime >= this.#duration) { - this.#finished(); + this.onfinish(); raf.animations.delete(this); } } @@ -128,7 +112,6 @@ class Animation { this.currentTime = null; // @ts-ignore this.startTime = null; - this.#cancelled(); raf.animations.delete(this); } }