emit events

pull/10798/head
Rich Harris 2 years ago
parent 1cff19a27b
commit 43e6e9d8ce

@ -107,9 +107,10 @@ export function transition(flags, element, get_fn, get_params) {
const intro = (flags & TRANSITION_IN) !== 0;
const outro = (flags & TRANSITION_OUT) !== 0;
const direction = intro && outro ? 'both' : intro ? 'in' : 'out';
const global = (flags & TRANSITION_GLOBAL) !== 0;
const direction = intro && outro ? 'both' : intro ? 'in' : 'out';
let p = 0;
/** @type {0 | TRANSITION_IN | TRANSITION_OUT} */
@ -137,6 +138,8 @@ export function transition(flags, element, get_fn, get_params) {
stop();
dispatch_event(element, target === 1 ? 'introstart' : 'outrostart');
current_options ??= get_fn()(element, get_params?.(), { direction });
if (!current_options?.duration) {
@ -175,6 +178,7 @@ export function transition(flags, element, get_fn, get_params) {
p = target;
current_animation = current_options = null;
callbacks.forEach(run);
dispatch_event(element, target === 1 ? 'introend' : 'outroend');
})
.catch(noop);
} else {
@ -194,6 +198,7 @@ export function transition(flags, element, get_fn, get_params) {
// dispatch(node, true, 'end'); TODO
current_task = null;
callbacks.forEach(run);
dispatch_event(element, target === 1 ? 'introend' : 'outroend');
return (running = false);
}
if (now >= start_time) {

Loading…
Cancel
Save