You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/transition-js-deferred/main.svelte

46 lines
645 B

<script>
export let visible;
let foo_text;
let bar_text;
function foo(node, params) {
foo_text = node.textContent;
return () => {
if (bar_text !== `b`) {
throw new Error(`foo ran prematurely`);
}
return {
duration: 100,
tick: t => {
node.foo = t;
}
};
};
}
function bar(node, params) {
bar_text = node.textContent;
return () => {
if (foo_text !== `a`) {
throw new Error(`bar ran prematurely`);
}
return {
duration: 100,
tick: t => {
node.foo = t;
}
};
};
}
</script>
{#if visible}
<div transition:foo>a</div>
{:else}
<div transition:bar>b</div>
{/if}