update unrelated test

pull/1677/head
Rich Harris 6 years ago
parent 620077227f
commit 3785a6d2ad

@ -65,11 +65,18 @@ define("test", function() { "use strict";
function init(component, options) { function init(component, options) {
component._handlers = blankObject(); component._handlers = blankObject();
component._slots = blankObject();
component._bind = options._bind; component._bind = options._bind;
component.options = options; component.options = options;
component.root = options.root || component; component.root = options.root || component;
component.store = options.store || component.root.store; component.store = options.store || component.root.store;
if (!options.root) {
component._beforecreate = [];
component._oncreate = [];
component._aftercreate = [];
}
} }
function assign(tar, src) { function assign(tar, src) {
@ -125,11 +132,7 @@ define("test", function() { "use strict";
function set(newState) { function set(newState) {
this._set(assign({}, newState)); this._set(assign({}, newState));
if (this.root._lock) return; if (this.root._lock) return;
this.root._lock = true; flush(this.root);
callAll(this.root._beforecreate);
callAll(this.root._oncreate);
callAll(this.root._aftercreate);
this.root._lock = false;
} }
function _set(newState) { function _set(newState) {
@ -165,8 +168,16 @@ define("test", function() { "use strict";
return Object.create(null); 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) { function callAll(fns) {
while (fns && fns.length) fns.shift()(); while (fns && fns.length) fns.shift()();
} }
return Main; return Main;
}); });
Loading…
Cancel
Save