Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow transition functions to return nothing #2246

Merged
merged 5 commits into from
Aug 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/runtime/internal/transitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export function transition_out(block, local: 0 | 1, detach: 0 | 1, callback) {
}
}

const null_transition: TransitionConfig = { duration: 0 };

type TransitionFn = (node: Element, params: any) => TransitionConfig;

export function create_in_transition(node: Element & ElementCSSInlineStyle, fn: TransitionFn, params: any) {
Expand All @@ -85,7 +87,7 @@ export function create_in_transition(node: Element & ElementCSSInlineStyle, fn:
easing = linear,
tick = noop,
css
} = config;
} = config || null_transition;

if (css) animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++);
tick(0, 1);
Expand Down Expand Up @@ -164,7 +166,7 @@ export function create_out_transition(node: Element & ElementCSSInlineStyle, fn:
easing = linear,
tick = noop,
css
} = config;
} = config || null_transition;

if (css) animation_name = create_rule(node, 1, 0, duration, delay, easing, css);

Expand Down Expand Up @@ -258,7 +260,7 @@ export function create_bidirectional_transition(node: Element & ElementCSSInline
easing = linear,
tick = noop,
css
} = config;
} = config || null_transition;

const program = {
start: now() + delay,
Expand Down