mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Update tests and Element.animate first parameter
The tests no longer test onsample, since it's not part of the standard.
This commit is contained in:
Vendored
+1
-1
@@ -103,7 +103,7 @@ declare class GroupEffect extends KeyframeEffect {
|
||||
constructor(effects: KeyframeEffect[]);
|
||||
}
|
||||
interface Element {
|
||||
animate(effect: AnimationKeyFrame | AnimationKeyFrame[], timing: number | AnimationEffectTiming): Animation;
|
||||
animate(effect: AnimationKeyFrame | AnimationKeyFrame[] | null, timing: number | AnimationEffectTiming): Animation;
|
||||
getAnimations(): Animation[];
|
||||
}
|
||||
interface Document {
|
||||
|
||||
@@ -88,31 +88,3 @@ function test_whiteRabbit() {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Testing onsample
|
||||
// https://github.com/web-animations/web-animations-js/releases
|
||||
function test_onsample_And_addEventListener() {
|
||||
const elem = document.createElement("div");
|
||||
if (elem) {
|
||||
elem.style.width = '150px';
|
||||
elem.style.color = 'black';
|
||||
elem.textContent = "HELLO";
|
||||
document.body.appendChild(elem);
|
||||
const myEffect = new KeyframeEffect(elem, [], 1000);
|
||||
myEffect.onsample = (timeFraction, effect, animation) => {
|
||||
console.log("fraction", timeFraction);
|
||||
// After finish event, timeFraction is null
|
||||
if (timeFraction) {
|
||||
effect.target.style.opacity = timeFraction.toFixed(2);
|
||||
}
|
||||
};
|
||||
// onsample is write only
|
||||
console.log(myEffect.onsample); // => undefined
|
||||
const myAnimation = document.timeline.play(myEffect);
|
||||
myAnimation.addEventListener("finish", (e) => {
|
||||
console.log("finished", e);
|
||||
});
|
||||
myAnimation.addEventListener("cancel", (e) => {
|
||||
console.log("canceled", e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user