0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00
svelte/test/js/samples/debug-empty/expected.js
Rich Harris f45e2b70fd
Implement reactive assignments (#1839)
This also includes elements of RFCs 2 and 3
2018-12-15 19:18:03 -05:00

88 lines
1.8 KiB
JavaScript

/* generated by Svelte vX.Y.Z */
import { SvelteComponentDev, addLoc, append, createElement, createText, detachNode, flush, init, insert, run, safe_not_equal, setData } from "svelte/internal.js";
const file = undefined;
function create_fragment(component, ctx) {
var h1, text0, text1, text2, text3, current;
return {
c: function create() {
h1 = createElement("h1");
text0 = createText("Hello ");
text1 = createText(ctx.name);
text2 = createText("!");
text3 = createText("\n");
debugger;
addLoc(h1, file, 0, 0, 0);
},
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
insert(target, h1, anchor);
append(h1, text0);
append(h1, text1);
append(h1, text2);
insert(target, text3, anchor);
current = true;
},
p: function update(changed, ctx) {
if (changed.name) {
setData(text1, ctx.name);
}
debugger;
},
i: function intro(target, anchor) {
if (current) return;
this.m(target, anchor);
},
o: run,
d: function destroy(detach) {
if (detach) {
detachNode(h1);
detachNode(text3);
}
}
};
}
function define($$self, $$props) {
let { name } = $$props;
$$self.$$.get = () => ({ name });
$$self.$$.set = $$props => {
if ('name' in $$props) name = $$props.name;
};
}
class SvelteComponent extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, define, create_fragment, safe_not_equal);
const state = this.$$.get();
if (state.name === undefined) {
console.warn("<SvelteComponent> was created without expected data property 'name'");
}
}
get name() {
return this.$$.get().name;
}
set name(value) {
this.$set({ name: value });
flush();
}
}
export default SvelteComponent;