dont call transition functions with component context

pull/1937/head
Richard Harris 6 years ago
parent e56c5653a7
commit f1bdfd84d8

@ -595,13 +595,13 @@ export default class ElementWrapper extends Wrapper {
if (${name}) ${name}.invalidate();
@add_render_callback(() => {
if (!${name}) ${name} = @wrapTransition(#component, ${this.var}, ${fn}, ${snippet}, true);
if (!${name}) ${name} = @create_transition(${this.var}, ${fn}, ${snippet}, true);
${name}.run(1);
});
`);
block.builders.outro.addBlock(deindent`
if (!${name}) ${name} = @wrapTransition(#component, ${this.var}, ${fn}, ${snippet}, false);
if (!${name}) ${name} = @create_transition(${this.var}, ${fn}, ${snippet}, false);
${name}.run(0, () => {
#outrocallback();
${name} = null;
@ -630,7 +630,7 @@ export default class ElementWrapper extends Wrapper {
block.builders.intro.addConditional(`@intros.enabled`, deindent`
@add_render_callback(() => {
${introName} = @wrapTransition(#component, ${this.var}, ${fn}, ${snippet}, true);
${introName} = @create_transition(${this.var}, ${fn}, ${snippet}, true);
${introName}.run(1);
});
`);
@ -651,7 +651,7 @@ export default class ElementWrapper extends Wrapper {
// TODO hide elements that have outro'd (unless they belong to a still-outroing
// group) prior to their removal from the DOM
block.builders.outro.addBlock(deindent`
${outroName} = @wrapTransition(#component, ${this.var}, ${fn}, ${snippet}, false);
${outroName} = @create_transition(${this.var}, ${fn}, ${snippet}, false);
${outroName}.run(0, #outrocallback);
`);

@ -24,13 +24,13 @@ export function group_outros() {
};
}
export function wrapTransition(component, node, fn, params, intro) {
let config = fn.call(component, node, params);
export function create_transition(node, fn, params, intro) {
let config = fn(node, params);
let duration;
let ease;
let cssText;
let initialised = false;
let ready = false;
let t = intro ? 0 : 1;
let running = false;
@ -106,14 +106,14 @@ export function wrapTransition(component, node, fn, params, intro) {
callback: callback || noop
};
if (intro && !initialised) {
if (intro && !ready) {
if (config.css && config.delay) {
cssText = node.style.cssText;
node.style.cssText += config.css(0, 1);
}
if (config.tick) config.tick(0, 1);
initialised = true;
ready = true;
}
if (!b) {

Loading…
Cancel
Save