Skip to content

Commit

Permalink
capricorn86#1092@patch: Simplifies AnimationEvent.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrotoff committed Sep 24, 2023
1 parent ad3733b commit 5403721
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/happy-dom/src/event/events/AnimationEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ import IAnimationEventInit from './IAnimationEventInit.js';
*
*/
export default class AnimationEvent extends Event {
public animationName = '';
public elapsedTime = 0;
public pseudoElement = '';
public readonly animationName: string;
public readonly elapsedTime: number;
public readonly pseudoElement: string;

/**
* Constructor.
*
* @param type Event type.
* @param [eventInit] Event init.
*/
constructor(type: string, eventInit?: IAnimationEventInit) {
constructor(type: string, eventInit: IAnimationEventInit = {}) {
super(type, eventInit);
this.animationName = eventInit?.animationName || '';
this.elapsedTime = eventInit?.elapsedTime || 0;
this.pseudoElement = eventInit?.pseudoElement || '';

this.animationName = eventInit.animationName ?? '';
this.elapsedTime = eventInit.elapsedTime ?? 0;
this.pseudoElement = eventInit.pseudoElement ?? '';
}
}

0 comments on commit 5403721

Please sign in to comment.