From d89d70e7a340773f2e5782b8a71344c2f022d0a1 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 6 Jul 2017 10:31:32 -0400 Subject: [PATCH] rename _renderHooks to _oncreate, since thats all its used for --- src/generators/dom/index.ts | 4 ++-- src/generators/dom/visitors/Element/addTransitions.ts | 4 ++-- src/shared/index.js | 6 +++--- .../collapses-text-around-comments/expected-bundle.js | 6 +++--- test/js/samples/computed-collapsed-if/expected-bundle.js | 6 +++--- .../samples/each-block-changed-check/expected-bundle.js | 6 +++--- test/js/samples/event-handlers-custom/expected-bundle.js | 6 +++--- test/js/samples/if-block-no-update/expected-bundle.js | 6 +++--- test/js/samples/if-block-simple/expected-bundle.js | 6 +++--- test/js/samples/non-imported-component/expected-bundle.js | 8 ++++---- test/js/samples/non-imported-component/expected.js | 2 +- .../onrender-onteardown-rewritten/expected-bundle.js | 8 ++++---- test/js/samples/onrender-onteardown-rewritten/expected.js | 2 +- .../js/samples/use-elements-as-anchors/expected-bundle.js | 6 +++--- 14 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts index 779029a5d8..ee04867668 100644 --- a/src/generators/dom/index.ts +++ b/src/generators/dom/index.ts @@ -200,7 +200,7 @@ export default function dom( options.css !== false && `if ( !document.getElementById( '${generator.cssId}-style' ) ) @add_css();`} ${(generator.hasComponents || generator.hasIntroTransitions) && - `this._renderHooks = [];`} + `this._oncreate = [];`} ${generator.hasComplexBindings && `this._bindings = [];`} this._fragment = @create_main_fragment( this._state, this ); @@ -227,7 +227,7 @@ export default function dom( ${templateProperties.oncreate && deindent` if ( options._root ) { - options._root._renderHooks.push( @template.oncreate.bind( this ) ); + options._root._oncreate.push( @template.oncreate.bind( this ) ); } else { @template.oncreate.call( this ); } diff --git a/src/generators/dom/visitors/Element/addTransitions.ts b/src/generators/dom/visitors/Element/addTransitions.ts index b533ef8536..d5f0f4c6f9 100644 --- a/src/generators/dom/visitors/Element/addTransitions.ts +++ b/src/generators/dom/visitors/Element/addTransitions.ts @@ -23,7 +23,7 @@ export default function addTransitions( const fn = `@template.transitions.${intro.name}`; block.builders.intro.addBlock(deindent` - #component._renderHooks.push( function () { + #component._oncreate.push( function () { if ( !${name} ) ${name} = @wrapTransition( ${state.name}, ${fn}, ${snippet}, true, null ); ${name}.run( true, function () { #component.fire( 'intro.end', { node: ${state.name} }); @@ -58,7 +58,7 @@ export default function addTransitions( } block.builders.intro.addBlock(deindent` - #component._renderHooks.push( function () { + #component._oncreate.push( function () { ${introName} = @wrapTransition( ${state.name}, ${fn}, ${snippet}, true, null ); ${introName}.run( true, function () { #component.fire( 'intro.end', { node: ${state.name} }); diff --git a/src/shared/index.js b/src/shared/index.js index b7b5ff7b64..5dde09c66f 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -110,10 +110,10 @@ export function set(newState) { } export function _flush() { - if (!this._renderHooks) return; + if (!this._oncreate) return; - while (this._renderHooks.length) { - this._renderHooks.pop()(); + while (this._oncreate.length) { + this._oncreate.pop()(); } } diff --git a/test/js/samples/collapses-text-around-comments/expected-bundle.js b/test/js/samples/collapses-text-around-comments/expected-bundle.js index 54bd3af679..057ece3065 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -119,10 +119,10 @@ function set(newState) { } function _flush() { - if (!this._renderHooks) return; + if (!this._oncreate) return; - while (this._renderHooks.length) { - this._renderHooks.pop()(); + while (this._oncreate.length) { + this._oncreate.pop()(); } } diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index d82dbc3616..d85fd55c51 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -95,10 +95,10 @@ function set(newState) { } function _flush() { - if (!this._renderHooks) return; + if (!this._oncreate) return; - while (this._renderHooks.length) { - this._renderHooks.pop()(); + while (this._oncreate.length) { + this._oncreate.pop()(); } } diff --git a/test/js/samples/each-block-changed-check/expected-bundle.js b/test/js/samples/each-block-changed-check/expected-bundle.js index 6f3a1a886d..4bbecf3f71 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -128,10 +128,10 @@ function set(newState) { } function _flush() { - if (!this._renderHooks) return; + if (!this._oncreate) return; - while (this._renderHooks.length) { - this._renderHooks.pop()(); + while (this._oncreate.length) { + this._oncreate.pop()(); } } diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index f7a9c0aa73..8fa8ead617 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -113,10 +113,10 @@ function set(newState) { } function _flush() { - if (!this._renderHooks) return; + if (!this._oncreate) return; - while (this._renderHooks.length) { - this._renderHooks.pop()(); + while (this._oncreate.length) { + this._oncreate.pop()(); } } diff --git a/test/js/samples/if-block-no-update/expected-bundle.js b/test/js/samples/if-block-no-update/expected-bundle.js index e017940f2e..65634e0748 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -119,10 +119,10 @@ function set(newState) { } function _flush() { - if (!this._renderHooks) return; + if (!this._oncreate) return; - while (this._renderHooks.length) { - this._renderHooks.pop()(); + while (this._oncreate.length) { + this._oncreate.pop()(); } } diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index 13695550b0..bf78f1ca68 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -119,10 +119,10 @@ function set(newState) { } function _flush() { - if (!this._renderHooks) return; + if (!this._oncreate) return; - while (this._renderHooks.length) { - this._renderHooks.pop()(); + while (this._oncreate.length) { + this._oncreate.pop()(); } } diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index cdcd2607bd..030c57369b 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -107,10 +107,10 @@ function set(newState) { } function _flush() { - if (!this._renderHooks) return; + if (!this._oncreate) return; - while (this._renderHooks.length) { - this._renderHooks.pop()(); + while (this._oncreate.length) { + this._oncreate.pop()(); } } @@ -183,7 +183,7 @@ function SvelteComponent ( options ) { this._yield = options._yield; this._torndown = false; - this._renderHooks = []; + this._oncreate = []; this._fragment = create_main_fragment( this._state, this ); diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js index 87c7e4b5b1..e2aa2d4457 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -62,7 +62,7 @@ function SvelteComponent ( options ) { this._yield = options._yield; this._torndown = false; - this._renderHooks = []; + this._oncreate = []; this._fragment = create_main_fragment( this._state, this ); diff --git a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js index 6998c7b5e0..f5849818fe 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js +++ b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js @@ -95,10 +95,10 @@ function set(newState) { } function _flush() { - if (!this._renderHooks) return; + if (!this._oncreate) return; - while (this._renderHooks.length) { - this._renderHooks.pop()(); + while (this._oncreate.length) { + this._oncreate.pop()(); } } @@ -156,7 +156,7 @@ function SvelteComponent ( options ) { } if ( options._root ) { - options._root._renderHooks.push( template.oncreate.bind( this ) ); + options._root._oncreate.push( template.oncreate.bind( this ) ); } else { template.oncreate.call( this ); } diff --git a/test/js/samples/onrender-onteardown-rewritten/expected.js b/test/js/samples/onrender-onteardown-rewritten/expected.js index 3869d14cb7..96aa37d766 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected.js +++ b/test/js/samples/onrender-onteardown-rewritten/expected.js @@ -45,7 +45,7 @@ function SvelteComponent ( options ) { } if ( options._root ) { - options._root._renderHooks.push( template.oncreate.bind( this ) ); + options._root._oncreate.push( template.oncreate.bind( this ) ); } else { template.oncreate.call( this ); } diff --git a/test/js/samples/use-elements-as-anchors/expected-bundle.js b/test/js/samples/use-elements-as-anchors/expected-bundle.js index 4037f07e34..63138c0157 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -119,10 +119,10 @@ function set(newState) { } function _flush() { - if (!this._renderHooks) return; + if (!this._oncreate) return; - while (this._renderHooks.length) { - this._renderHooks.pop()(); + while (this._oncreate.length) { + this._oncreate.pop()(); } }