0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 00:46:29 +01:00
svelte/test/js/samples/instrumentation-script-x-equals-x/expected.js

65 lines
1.4 KiB
JavaScript

/* generated by Svelte vX.Y.Z */
import { SvelteComponent as SvelteComponent_1, addListener, append, createElement, createText, detachNode, init, insert, noop, safe_not_equal, setData } from "svelte/internal";
function create_fragment(ctx) {
var button, text1, p, text2, text3_value = ctx.things.length, text3, dispose;
return {
c() {
button = createElement("button");
button.textContent = "foo";
text1 = createText("\n\n");
p = createElement("p");
text2 = createText("number of things: ");
text3 = createText(text3_value);
dispose = addListener(button, "click", ctx.foo);
},
m(target, anchor) {
insert(target, button, anchor);
insert(target, text1, anchor);
insert(target, p, anchor);
append(p, text2);
append(p, text3);
},
p(changed, ctx) {
if ((changed.things) && text3_value !== (text3_value = ctx.things.length)) {
setData(text3, text3_value);
}
},
i: noop,
o: noop,
d(detach) {
if (detach) {
detachNode(button);
detachNode(text1);
detachNode(p);
}
dispose();
}
};
}
function instance($$self, $$props, $$invalidate) {
let things = [];
function foo() {
things.push(1);
$$invalidate('things', things);
}
return { things, foo };
}
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal);
}
}
export default SvelteComponent;