diff --git a/src/generators/dom/index.js b/src/generators/dom/index.js index b208b1e122..69105e8b2a 100644 --- a/src/generators/dom/index.js +++ b/src/generators/dom/index.js @@ -355,12 +355,13 @@ export default function dom ( parsed, source, options, names ) { ${name}.prototype._flush = ${shared._flush}; ` ); + // TODO deprecate component.teardown() builders.main.addBlock( deindent` ${name}.prototype._set = function _set ( newState ) { ${builders._set} }; - ${name}.prototype.teardown = function teardown ( detach ) { + ${name}.prototype.teardown = ${name}.prototype.destroy = function destroy ( detach ) { this.fire( 'teardown' );${templateProperties.ondestroy ? `\ntemplate.ondestroy.call( this );` : ``} this._fragment.teardown( detach !== false ); diff --git a/src/generators/dom/visitors/Component.js b/src/generators/dom/visitors/Component.js index a7d114cbe6..edd6a5209c 100644 --- a/src/generators/dom/visitors/Component.js +++ b/src/generators/dom/visitors/Component.js @@ -137,7 +137,7 @@ export default { ` ); } - generator.current.builders.teardown.addLine( `${name}.teardown( ${isToplevel ? 'detach' : 'false'} );` ); + generator.current.builders.teardown.addLine( `${name}.destroy( ${isToplevel ? 'detach' : 'false'} );` ); generator.current.builders.init.addBlock( local.init ); if ( !local.update.isEmpty() ) generator.current.builders.update.addBlock( local.update );