|
|
|
@ -48,10 +48,6 @@ function dispatchObservers(component, group, changed, newState, oldState) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get(key) {
|
|
|
|
|
return key ? this._state[key] : this._state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fire(eventName, data) {
|
|
|
|
|
var handlers =
|
|
|
|
|
eventName in this._handlers && this._handlers[eventName].slice();
|
|
|
|
@ -62,6 +58,25 @@ function fire(eventName, data) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get(key) {
|
|
|
|
|
return key ? this._state[key] : this._state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function init(component, options) {
|
|
|
|
|
component.options = options;
|
|
|
|
|
|
|
|
|
|
component._observers = {
|
|
|
|
|
pre: Object.create(null),
|
|
|
|
|
post: Object.create(null)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
component._handlers = Object.create(null);
|
|
|
|
|
|
|
|
|
|
component._root = options._root || component;
|
|
|
|
|
component._yield = options._yield;
|
|
|
|
|
component._bind = options._bind;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function observe(key, callback, options) {
|
|
|
|
|
var group = options && options.defer
|
|
|
|
|
? this._observers.post
|
|
|
|
@ -176,21 +191,10 @@ function create_main_fragment(state, component) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SvelteComponent(options) {
|
|
|
|
|
this.options = options;
|
|
|
|
|
init(this, options);
|
|
|
|
|
this._state = options.data || {};
|
|
|
|
|
this._recompute({}, this._state, {}, true);
|
|
|
|
|
|
|
|
|
|
this._observers = {
|
|
|
|
|
pre: Object.create(null),
|
|
|
|
|
post: Object.create(null)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this._handlers = Object.create(null);
|
|
|
|
|
|
|
|
|
|
this._root = options._root || this;
|
|
|
|
|
this._yield = options._yield;
|
|
|
|
|
this._bind = options._bind;
|
|
|
|
|
|
|
|
|
|
this._fragment = create_main_fragment(this._state, this);
|
|
|
|
|
|
|
|
|
|
if (options.target) {
|
|
|
|
|