Skip to content

Commit d3ef8a9

Browse files
committed
fix intro events
1 parent e5cc4c0 commit d3ef8a9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/svelte/src/internal/client/dom/elements/transitions.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ export function transition(flags, element, get_fn, get_params) {
166166
element.inert = inert;
167167

168168
if (is_intro) {
169+
dispatch_event(element, 'introstart');
169170
intro = animate(element, get_options(), outro, 1, () => {
171+
dispatch_event(element, 'introend');
170172
intro = current_options = undefined;
171173
});
172174
} else {
@@ -178,7 +180,9 @@ export function transition(flags, element, get_fn, get_params) {
178180
if (is_outro) {
179181
element.inert = true;
180182

183+
dispatch_event(element, 'outrostart');
181184
outro = animate(element, get_options(), intro, 0, () => {
185+
dispatch_event(element, 'outroend');
182186
outro = current_options = undefined;
183187
fn?.();
184188
});
@@ -258,8 +262,6 @@ function animate(element, options, counterpart, t2, callback) {
258262
};
259263
}
260264

261-
dispatch_event(element, t2 === 1 ? 'introstart' : 'outrostart'); // TODO not for `animate:`
262-
263265
var { delay = 0, duration, css, tick, easing = linear } = options;
264266

265267
var start = raf.now() + delay;
@@ -296,7 +298,6 @@ function animate(element, options, counterpart, t2, callback) {
296298
animation.finished
297299
.then(() => {
298300
callback?.();
299-
dispatch_event(element, t2 === 1 ? 'introend' : 'outroend');
300301
})
301302
.catch(noop);
302303
} else {
@@ -309,7 +310,6 @@ function animate(element, options, counterpart, t2, callback) {
309310
if (now >= end) {
310311
tick?.(t2, 1 - t2);
311312
callback?.();
312-
dispatch_event(element, t2 === 1 ? 'introend' : 'outroend');
313313
return false;
314314
}
315315

0 commit comments

Comments
 (0)