Revert "fix handler in-place"

This reverts commit 6ebf46ad67.
pull/1296/head
Rich-Harris 7 years ago
parent e585ccf242
commit 6e5523cb89

@ -516,16 +516,16 @@ export default class Element extends Node {
}); });
`); `);
if (generator.options.dev) {
block.builders.hydrate.addBlock(deindent` block.builders.hydrate.addBlock(deindent`
if (${handlerName}.teardown) { if (${handlerName}.teardown) {
${handlerName}.destroy = ${handlerName}.teardown; console.warn("Return 'destroy()' from custom event handlers. Returning 'teardown()' has been deprecated and will be unsupported in Svelte 2");
${generator.options.dev && `console.warn("Return 'destroy()' from custom event handlers. Returning 'teardown()' has been deprecated and will be unsupported in Svelte 2");`}
} }
`); `);
}
block.builders.destroy.addLine(deindent` block.builders.destroy.addLine(deindent`
${handlerName}.destroy(); ${handlerName}[${handlerName}.destroy ? 'destroy' : 'teardown']();
`); `);
} else { } else {
const handler = deindent` const handler = deindent`

@ -199,10 +199,6 @@ function create_main_fragment(component, state) {
var state = component.get(); var state = component.get();
component.foo( state.bar ); component.foo( state.bar );
}); });
if (foo_handler.teardown) {
foo_handler.destroy = foo_handler.teardown;
}
}, },
m: function mount(target, anchor) { m: function mount(target, anchor) {
@ -216,7 +212,7 @@ function create_main_fragment(component, state) {
}, },
d: function destroy$$1() { d: function destroy$$1() {
foo_handler.destroy(); foo_handler[foo_handler.destroy ? 'destroy' : 'teardown']();
} }
}; };
} }

@ -26,10 +26,6 @@ function create_main_fragment(component, state) {
var state = component.get(); var state = component.get();
component.foo( state.bar ); component.foo( state.bar );
}); });
if (foo_handler.teardown) {
foo_handler.destroy = foo_handler.teardown;
}
}, },
m: function mount(target, anchor) { m: function mount(target, anchor) {
@ -43,7 +39,7 @@ function create_main_fragment(component, state) {
}, },
d: function destroy() { d: function destroy() {
foo_handler.destroy(); foo_handler[foo_handler.destroy ? 'destroy' : 'teardown']();
} }
}; };
} }

Loading…
Cancel
Save