0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 17:00:40 +01:00

Revert "fix handler in-place"

This reverts commit 6ebf46ad67.
This commit is contained in:
Rich-Harris 2018-03-30 16:33:41 -04:00
parent e585ccf242
commit 6e5523cb89
3 changed files with 10 additions and 18 deletions

View File

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

View File

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

View File

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