Merge pull request #171 from sveltejs/gh-150

make mount private
pull/173/head
Rich Harris 8 years ago committed by GitHub
commit abda99fd14

@ -425,7 +425,7 @@ export default function generate ( parsed, source, options, names ) {
initStatements.push( deindent` initStatements.push( deindent`
this.__bindings = []; this.__bindings = [];
var mainFragment = renderMainFragment( state, this ); var mainFragment = renderMainFragment( state, this );
if ( options.target ) this.mount( options.target ); if ( options.target ) this._mount( options.target );
while ( this.__bindings.length ) this.__bindings.pop()(); while ( this.__bindings.length ) this.__bindings.pop()();
` ); ` );
@ -433,7 +433,7 @@ export default function generate ( parsed, source, options, names ) {
} else { } else {
initStatements.push( deindent` initStatements.push( deindent`
var mainFragment = renderMainFragment( state, this ); var mainFragment = renderMainFragment( state, this );
if ( options.target ) this.mount( options.target ); if ( options.target ) this._mount( options.target );
` ); ` );
} }
@ -515,7 +515,7 @@ export default function generate ( parsed, source, options, names ) {
${setStatements.join( '\n\n' )} ${setStatements.join( '\n\n' )}
}; };
this.mount = function mount ( target, anchor ) { this._mount = function mount ( target, anchor ) {
mainFragment.mount( target, anchor ); mainFragment.mount( target, anchor );
} }

@ -80,7 +80,7 @@ export default {
` ); ` );
if ( isToplevel ) { if ( isToplevel ) {
local.mount.unshift( `${name}.mount( target, anchor );` ); local.mount.unshift( `${name}._mount( target, anchor );` );
} }
if ( local.dynamicAttributes.length ) { if ( local.dynamicAttributes.length ) {

Loading…
Cancel
Save