diff --git a/test/cli/samples/basic/expected/Main.js b/test/cli/samples/basic/expected/Main.js index 67af2d675a..7d24fd3862 100644 --- a/test/cli/samples/basic/expected/Main.js +++ b/test/cli/samples/basic/expected/Main.js @@ -65,11 +65,18 @@ function detachNode(node) { function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -125,11 +132,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -165,6 +168,14 @@ function blankObject() { return Object.create(null); } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } diff --git a/test/cli/samples/custom-element/expected/Main.js b/test/cli/samples/custom-element/expected/Main.js index 0a72476e01..1d34cc12a6 100644 --- a/test/cli/samples/custom-element/expected/Main.js +++ b/test/cli/samples/custom-element/expected/Main.js @@ -86,11 +86,18 @@ function detachNode(node) { function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -146,11 +153,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -186,6 +189,14 @@ function blankObject() { return Object.create(null); } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } diff --git a/test/cli/samples/dev/expected/Main.js b/test/cli/samples/dev/expected/Main.js index d342cfb2db..e32ea9a61e 100644 --- a/test/cli/samples/dev/expected/Main.js +++ b/test/cli/samples/dev/expected/Main.js @@ -89,11 +89,18 @@ function detachNode(node) { function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -200,11 +207,15 @@ function destroy(detach) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); +} + +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; } function callAll(fns) { diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js b/test/cli/samples/dir-sourcemap/expected/Main.js index 31c1929c53..884f11d1d3 100644 --- a/test/cli/samples/dir-sourcemap/expected/Main.js +++ b/test/cli/samples/dir-sourcemap/expected/Main.js @@ -32,23 +32,13 @@ function Main(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } @@ -69,11 +59,18 @@ function noop() {} function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -81,8 +78,12 @@ function assign(tar, src) { return tar; } -function callAll(fns) { - while (fns && fns.length) fns.shift()(); +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; } function destroy(detach) { @@ -133,11 +134,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -172,5 +169,9 @@ function _differs(a, b) { function blankObject() { return Object.create(null); } + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} export default Main; //# sourceMappingURL=Main.js.map diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js.map b/test/cli/samples/dir-sourcemap/expected/Main.js.map index 7c0c800ddb..1d09d8ade9 100644 --- a/test/cli/samples/dir-sourcemap/expected/Main.js.map +++ b/test/cli/samples/dir-sourcemap/expected/Main.js.map @@ -1 +1 @@ -{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js b/test/cli/samples/dir-sourcemap/expected/Widget.js index bb77a8bd13..99c6e08a0e 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js @@ -65,11 +65,18 @@ function detachNode(node) { function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -125,11 +132,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -165,6 +168,14 @@ function blankObject() { return Object.create(null); } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js.map b/test/cli/samples/dir-sourcemap/expected/Widget.js.map index 3fcdc995a4..f4303844df 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js.map +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js.map @@ -1 +1 @@ -{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["

widget

"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["

widget

"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/dir-subdir/expected/Main.js b/test/cli/samples/dir-subdir/expected/Main.js index 2e908cfa44..4b1803f5fc 100644 --- a/test/cli/samples/dir-subdir/expected/Main.js +++ b/test/cli/samples/dir-subdir/expected/Main.js @@ -32,23 +32,13 @@ function Main(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } @@ -69,11 +59,18 @@ function noop() {} function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -81,8 +78,12 @@ function assign(tar, src) { return tar; } -function callAll(fns) { - while (fns && fns.length) fns.shift()(); +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; } function destroy(detach) { @@ -133,11 +134,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -172,4 +169,8 @@ function _differs(a, b) { function blankObject() { return Object.create(null); } + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} export default Main; \ No newline at end of file diff --git a/test/cli/samples/dir-subdir/expected/widget/Widget.js b/test/cli/samples/dir-subdir/expected/widget/Widget.js index e368f4d9b6..5c6241e320 100644 --- a/test/cli/samples/dir-subdir/expected/widget/Widget.js +++ b/test/cli/samples/dir-subdir/expected/widget/Widget.js @@ -65,11 +65,18 @@ function detachNode(node) { function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -125,11 +132,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -165,6 +168,14 @@ function blankObject() { return Object.create(null); } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } diff --git a/test/cli/samples/dir/expected/Main.js b/test/cli/samples/dir/expected/Main.js index 9a9d8e38fe..dc82848d2e 100644 --- a/test/cli/samples/dir/expected/Main.js +++ b/test/cli/samples/dir/expected/Main.js @@ -32,23 +32,13 @@ function Main(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } @@ -69,11 +59,18 @@ function noop() {} function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -81,8 +78,12 @@ function assign(tar, src) { return tar; } -function callAll(fns) { - while (fns && fns.length) fns.shift()(); +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; } function destroy(detach) { @@ -133,11 +134,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -172,4 +169,8 @@ function _differs(a, b) { function blankObject() { return Object.create(null); } + +function callAll(fns) { + while (fns && fns.length) fns.shift()(); +} export default Main; \ No newline at end of file diff --git a/test/cli/samples/dir/expected/Widget.js b/test/cli/samples/dir/expected/Widget.js index 91d975a48f..2896558acc 100644 --- a/test/cli/samples/dir/expected/Widget.js +++ b/test/cli/samples/dir/expected/Widget.js @@ -65,11 +65,18 @@ function detachNode(node) { function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -125,11 +132,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -165,6 +168,14 @@ function blankObject() { return Object.create(null); } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } diff --git a/test/cli/samples/globals/expected/Main.js b/test/cli/samples/globals/expected/Main.js index 5f5b5093f4..62d5a02694 100644 --- a/test/cli/samples/globals/expected/Main.js +++ b/test/cli/samples/globals/expected/Main.js @@ -90,11 +90,18 @@ var Main = (function(answer) { "use strict"; function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -150,11 +157,7 @@ var Main = (function(answer) { "use strict"; function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -192,6 +195,14 @@ var Main = (function(answer) { "use strict"; return Object.create(null); } + function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; + } + function callAll(fns) { while (fns && fns.length) fns.shift()(); } diff --git a/test/cli/samples/sourcemap-inline/expected/Main.js b/test/cli/samples/sourcemap-inline/expected/Main.js index 248b810373..f4cbc7d8df 100644 --- a/test/cli/samples/sourcemap-inline/expected/Main.js +++ b/test/cli/samples/sourcemap-inline/expected/Main.js @@ -65,11 +65,18 @@ function detachNode(node) { function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -125,11 +132,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -165,8 +168,16 @@ function blankObject() { return Object.create(null); } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } export default Main; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFpbi5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL01haW4uaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8cD5IZWxsbyB3b3JsZCE8L3A+XG5cbjxzY3JpcHQ+XG5cdGV4cG9ydCBkZWZhdWx0IHtcblx0XHRvbnJlbmRlciAoKSB7XG5cdFx0XHRjb25zb2xlLmxvZyggJ2hlcmUnICk7XG5cdFx0fVxuXHR9O1xuPC9zY3JpcHQ+Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFpbi5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL01haW4uaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8cD5IZWxsbyB3b3JsZCE8L3A+XG5cbjxzY3JpcHQ+XG5cdGV4cG9ydCBkZWZhdWx0IHtcblx0XHRvbnJlbmRlciAoKSB7XG5cdFx0XHRjb25zb2xlLmxvZyggJ2hlcmUnICk7XG5cdFx0fVxuXHR9O1xuPC9zY3JpcHQ+Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0= diff --git a/test/cli/samples/sourcemap/expected/Main.js b/test/cli/samples/sourcemap/expected/Main.js index 59ed9b7367..43ee0b6b7f 100644 --- a/test/cli/samples/sourcemap/expected/Main.js +++ b/test/cli/samples/sourcemap/expected/Main.js @@ -65,11 +65,18 @@ function detachNode(node) { function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -125,11 +132,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -165,6 +168,14 @@ function blankObject() { return Object.create(null); } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } diff --git a/test/cli/samples/sourcemap/expected/Main.js.map b/test/cli/samples/sourcemap/expected/Main.js.map index eab12a290f..a6fe370c69 100644 --- a/test/cli/samples/sourcemap/expected/Main.js.map +++ b/test/cli/samples/sourcemap/expected/Main.js.map @@ -1 +1 @@ -{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["

Hello world!

\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["

Hello world!

\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/store/expected/Main.js b/test/cli/samples/store/expected/Main.js index ef8e170b39..e3beb9d80f 100644 --- a/test/cli/samples/store/expected/Main.js +++ b/test/cli/samples/store/expected/Main.js @@ -85,11 +85,18 @@ function detachNode(node) { function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function assign(tar, src) { @@ -149,11 +156,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -191,6 +194,14 @@ function blankObject() { return Object.create(null); } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } diff --git a/test/js/samples/action/expected-bundle.js b/test/js/samples/action/expected-bundle.js index d47781ac82..659a47019f 100644 --- a/test/js/samples/action/expected-bundle.js +++ b/test/js/samples/action/expected-bundle.js @@ -54,17 +54,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -82,11 +97,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/bind-width-height/expected-bundle.js b/test/js/samples/bind-width-height/expected-bundle.js index a7f8a3f616..f0232218ac 100644 --- a/test/js/samples/bind-width-height/expected-bundle.js +++ b/test/js/samples/bind-width-height/expected-bundle.js @@ -86,17 +86,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -114,11 +129,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -200,18 +211,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - callAll(this._beforecreate); + flush(this); } } diff --git a/test/js/samples/bind-width-height/expected.js b/test/js/samples/bind-width-height/expected.js index 5f0990fa00..bb2bf2554a 100644 --- a/test/js/samples/bind-width-height/expected.js +++ b/test/js/samples/bind-width-height/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { addResizeListener, assign, callAll, createElement, detachNode, init, insert, noop, proto } from "svelte/shared.js"; +import { addResizeListener, assign, createElement, detachNode, flush, init, insert, noop, proto } from "svelte/shared.js"; function create_main_fragment(component, ctx) { var div, div_resize_listener; @@ -37,18 +37,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - callAll(this._beforecreate); + flush(this); } } 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 3c2ccba90e..58f2fbb09c 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -66,17 +66,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -94,11 +109,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/component-static-array/expected-bundle.js b/test/js/samples/component-static-array/expected-bundle.js index 30534f977e..3bbb1ede27 100644 --- a/test/js/samples/component-static-array/expected-bundle.js +++ b/test/js/samples/component-static-array/expected-bundle.js @@ -42,17 +42,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -70,11 +85,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -153,23 +164,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } diff --git a/test/js/samples/component-static-array/expected.js b/test/js/samples/component-static-array/expected.js index bae0c850f7..2b18d210a6 100644 --- a/test/js/samples/component-static-array/expected.js +++ b/test/js/samples/component-static-array/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { assign, callAll, init, noop, proto } from "svelte/shared.js"; +import { assign, flush, init, noop, proto } from "svelte/shared.js"; var Nested = window.Nested; @@ -34,23 +34,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } diff --git a/test/js/samples/component-static-immutable/expected-bundle.js b/test/js/samples/component-static-immutable/expected-bundle.js index de9fc1a4a2..98f6b26fec 100644 --- a/test/js/samples/component-static-immutable/expected-bundle.js +++ b/test/js/samples/component-static-immutable/expected-bundle.js @@ -46,17 +46,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -74,11 +89,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -157,23 +168,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } diff --git a/test/js/samples/component-static-immutable/expected.js b/test/js/samples/component-static-immutable/expected.js index f40f060325..72e03ffe7c 100644 --- a/test/js/samples/component-static-immutable/expected.js +++ b/test/js/samples/component-static-immutable/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { _differsImmutable, assign, callAll, init, noop, proto } from "svelte/shared.js"; +import { _differsImmutable, assign, flush, init, noop, proto } from "svelte/shared.js"; var Nested = window.Nested; @@ -34,23 +34,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } diff --git a/test/js/samples/component-static-immutable2/expected-bundle.js b/test/js/samples/component-static-immutable2/expected-bundle.js index de9fc1a4a2..98f6b26fec 100644 --- a/test/js/samples/component-static-immutable2/expected-bundle.js +++ b/test/js/samples/component-static-immutable2/expected-bundle.js @@ -46,17 +46,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -74,11 +89,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -157,23 +168,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } diff --git a/test/js/samples/component-static-immutable2/expected.js b/test/js/samples/component-static-immutable2/expected.js index f40f060325..72e03ffe7c 100644 --- a/test/js/samples/component-static-immutable2/expected.js +++ b/test/js/samples/component-static-immutable2/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { _differsImmutable, assign, callAll, init, noop, proto } from "svelte/shared.js"; +import { _differsImmutable, assign, flush, init, noop, proto } from "svelte/shared.js"; var Nested = window.Nested; @@ -34,23 +34,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index af59f9e893..4c394bba1d 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -42,17 +42,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -70,11 +85,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -153,23 +164,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } diff --git a/test/js/samples/component-static/expected.js b/test/js/samples/component-static/expected.js index 1a5631fc58..e619014b67 100644 --- a/test/js/samples/component-static/expected.js +++ b/test/js/samples/component-static/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { assign, callAll, init, noop, proto } from "svelte/shared.js"; +import { assign, flush, init, noop, proto } from "svelte/shared.js"; var Nested = window.Nested; @@ -34,23 +34,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index a2ba378a2a..94cb7c3ef3 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -42,17 +42,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -70,11 +85,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index f3d74e22d2..703ef5f6c0 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -58,17 +58,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -86,11 +101,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js index 4fe3a903fc..0bb956d285 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -54,17 +54,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -82,11 +97,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/debug-empty/expected-bundle.js b/test/js/samples/debug-empty/expected-bundle.js index 36f2b87a80..0faf822be3 100644 --- a/test/js/samples/debug-empty/expected-bundle.js +++ b/test/js/samples/debug-empty/expected-bundle.js @@ -79,17 +79,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -107,11 +122,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js b/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js index a6c539929c..521d57af5b 100644 --- a/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js +++ b/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js @@ -85,17 +85,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -113,11 +128,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/debug-foo/expected-bundle.js b/test/js/samples/debug-foo/expected-bundle.js index 8e2147c322..5cc1c7a469 100644 --- a/test/js/samples/debug-foo/expected-bundle.js +++ b/test/js/samples/debug-foo/expected-bundle.js @@ -85,17 +85,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -113,11 +128,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/deconflict-builtins/expected-bundle.js b/test/js/samples/deconflict-builtins/expected-bundle.js index ead082d78f..eae32e976c 100644 --- a/test/js/samples/deconflict-builtins/expected-bundle.js +++ b/test/js/samples/deconflict-builtins/expected-bundle.js @@ -76,17 +76,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -104,11 +119,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/deconflict-globals/expected-bundle.js b/test/js/samples/deconflict-globals/expected-bundle.js index 45e4bed141..28b8d1f46b 100644 --- a/test/js/samples/deconflict-globals/expected-bundle.js +++ b/test/js/samples/deconflict-globals/expected-bundle.js @@ -47,17 +47,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -75,11 +90,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -152,10 +163,6 @@ function SvelteComponent(options) { this._state = assign(data_1(), options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - } - this._fragment = create_main_fragment(this, this._state); this.root._oncreate.push(() => { @@ -167,7 +174,7 @@ function SvelteComponent(options) { this._fragment.c(); this._mount(options.target, options.anchor); - callAll(this._oncreate); + flush(this); } } diff --git a/test/js/samples/deconflict-globals/expected.js b/test/js/samples/deconflict-globals/expected.js index 275f189df7..daaf8005c2 100644 --- a/test/js/samples/deconflict-globals/expected.js +++ b/test/js/samples/deconflict-globals/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { assign, assignTrue, callAll, init, noop, proto } from "svelte/shared.js"; +import { assign, assignTrue, flush, init, noop, proto } from "svelte/shared.js"; function data_1() { return { @@ -29,10 +29,6 @@ function SvelteComponent(options) { this._state = assign(data_1(), options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - } - this._fragment = create_main_fragment(this, this._state); this.root._oncreate.push(() => { @@ -44,7 +40,7 @@ function SvelteComponent(options) { this._fragment.c(); this._mount(options.target, options.anchor); - callAll(this._oncreate); + flush(this); } } diff --git a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js index 0887f42612..73fdae3223 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js @@ -79,17 +79,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -107,11 +122,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/do-use-dataset/expected-bundle.js b/test/js/samples/do-use-dataset/expected-bundle.js index b9e7b56265..d981b929a7 100644 --- a/test/js/samples/do-use-dataset/expected-bundle.js +++ b/test/js/samples/do-use-dataset/expected-bundle.js @@ -58,17 +58,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -86,11 +101,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js b/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js index 30890b83a3..3be0e2a270 100644 --- a/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js +++ b/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js @@ -62,17 +62,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -90,11 +105,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js b/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js index 9c006e2870..5b73e51762 100644 --- a/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js +++ b/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js @@ -62,17 +62,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -90,11 +105,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { 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 01fb8671ce..ce97c56af5 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -78,17 +78,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -106,11 +121,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/each-block-keyed-animated/expected-bundle.js b/test/js/samples/each-block-keyed-animated/expected-bundle.js index 57ba9366ab..1cfdf681f0 100644 --- a/test/js/samples/each-block-keyed-animated/expected-bundle.js +++ b/test/js/samples/each-block-keyed-animated/expected-bundle.js @@ -381,17 +381,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -409,11 +424,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/each-block-keyed/expected-bundle.js b/test/js/samples/each-block-keyed/expected-bundle.js index 7242dc98ba..1cc34f4455 100644 --- a/test/js/samples/each-block-keyed/expected-bundle.js +++ b/test/js/samples/each-block-keyed/expected-bundle.js @@ -161,17 +161,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -189,11 +204,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 73526d1c61..23327a276a 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -54,17 +54,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -82,11 +97,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/head-no-whitespace/expected-bundle.js b/test/js/samples/head-no-whitespace/expected-bundle.js index baddc6b82e..91eaa6cd5b 100644 --- a/test/js/samples/head-no-whitespace/expected-bundle.js +++ b/test/js/samples/head-no-whitespace/expected-bundle.js @@ -54,17 +54,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -82,11 +97,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { 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 5d410c6ae8..83c3f60db0 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -58,17 +58,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -86,11 +101,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index 27d7b8a5f2..24b9e526cd 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -58,17 +58,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -86,11 +101,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js index c0f3ff99d2..78e6cc7e40 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -58,17 +58,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -86,11 +101,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/inline-style-optimized-url/expected-bundle.js b/test/js/samples/inline-style-optimized-url/expected-bundle.js index b04307dc3c..9fd8e681a6 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -58,17 +58,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -86,11 +101,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index ee08f28f21..d8f9b7d7d2 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -58,17 +58,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -86,11 +101,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index 1ec722ca2d..b46055315e 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -58,17 +58,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -86,11 +101,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/input-files/expected-bundle.js b/test/js/samples/input-files/expected-bundle.js index 1a6376f193..b3218c7fd4 100644 --- a/test/js/samples/input-files/expected-bundle.js +++ b/test/js/samples/input-files/expected-bundle.js @@ -66,17 +66,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -94,11 +109,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/input-range/expected-bundle.js b/test/js/samples/input-range/expected-bundle.js index f9b53e91a5..2f53e740ea 100644 --- a/test/js/samples/input-range/expected-bundle.js +++ b/test/js/samples/input-range/expected-bundle.js @@ -70,17 +70,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -98,11 +113,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/input-without-blowback-guard/expected-bundle.js b/test/js/samples/input-without-blowback-guard/expected-bundle.js index c3abad14fe..b5f7a90f8c 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -66,17 +66,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -94,11 +109,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index e72c5538d5..cd841f8a2d 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -60,17 +60,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -88,11 +103,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index 4af5ac49d3..d9f961f564 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -70,17 +70,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -98,11 +113,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -232,18 +243,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - callAll(this._beforecreate); + flush(this); } } diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js index 59dc55b528..97753a1995 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { addListener, assign, callAll, createElement, detachNode, init, insert, proto, removeListener, timeRangesToArray } from "svelte/shared.js"; +import { addListener, assign, createElement, detachNode, flush, init, insert, proto, removeListener, timeRangesToArray } from "svelte/shared.js"; function create_main_fragment(component, ctx) { var audio, audio_is_paused = true, audio_updating = false, audio_animationframe; @@ -85,18 +85,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - callAll(this._beforecreate); + flush(this); } } diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index 649f6b1f61..b890d8bed5 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -56,17 +56,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -84,11 +99,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { @@ -180,23 +191,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js index f7d1462a80..8e47d1b1d3 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { assign, callAll, createText, detachNode, init, insert, noop, proto } from "svelte/shared.js"; +import { assign, createText, detachNode, flush, init, insert, noop, proto } from "svelte/shared.js"; import Imported from 'Imported.html'; @@ -48,23 +48,13 @@ function SvelteComponent(options) { this._state = assign({}, options.data); this._intro = true; - if (!options.root) { - this._oncreate = []; - this._beforecreate = []; - this._aftercreate = []; - } - this._fragment = create_main_fragment(this, this._state); if (options.target) { this._fragment.c(); this._mount(options.target, options.anchor); - this._lock = true; - callAll(this._beforecreate); - callAll(this._oncreate); - callAll(this._aftercreate); - this._lock = false; + flush(this); } } diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index 5781b383a1..fa63c78502 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -42,17 +42,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -70,11 +85,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/svg-title/expected-bundle.js b/test/js/samples/svg-title/expected-bundle.js index 4fa8bb9e34..269f6ca1f3 100644 --- a/test/js/samples/svg-title/expected-bundle.js +++ b/test/js/samples/svg-title/expected-bundle.js @@ -62,17 +62,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -90,11 +105,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/title/expected-bundle.js b/test/js/samples/title/expected-bundle.js index e994b9fdfc..f0afba9d24 100644 --- a/test/js/samples/title/expected-bundle.js +++ b/test/js/samples/title/expected-bundle.js @@ -42,17 +42,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -70,11 +85,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { 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 e9c3391f88..4065ba55ad 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -66,17 +66,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -94,11 +109,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) { diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index 4c835f62b3..7823390a2c 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -66,17 +66,32 @@ function fire(eventName, data) { } } +function flush(component) { + component._lock = true; + callAll(component._beforecreate); + callAll(component._oncreate); + callAll(component._aftercreate); + component._lock = false; +} + function get() { return this._state; } function init(component, options) { component._handlers = blankObject(); + component._slots = blankObject(); component._bind = options._bind; component.options = options; component.root = options.root || component; component.store = options.store || component.root.store; + + if (!options.root) { + component._beforecreate = []; + component._oncreate = []; + component._aftercreate = []; + } } function on(eventName, handler) { @@ -94,11 +109,7 @@ function on(eventName, handler) { function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; - this.root._lock = true; - callAll(this.root._beforecreate); - callAll(this.root._oncreate); - callAll(this.root._aftercreate); - this.root._lock = false; + flush(this.root); } function _set(newState) {