You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/js/samples/instrumentation-template-x-.../expected.js

75 lines
1.3 KiB

/* generated by Svelte vX.Y.Z */
6 years ago
import {
SvelteComponent,
6 years ago
append,
detach,
element,
init,
insert,
listen,
noop,
safe_not_equal,
set_data,
space,
6 years ago
text
} from "svelte/internal";
function create_fragment(ctx) {
6 years ago
var button, t1, p, t2, t3_value = ctx.things.length, t3, dispose;
return {
c() {
6 years ago
button = element("button");
button.textContent = "foo";
t1 = space();
6 years ago
p = element("p");
t2 = text("number of things: ");
t3 = text(t3_value);
dispose = listen(button, "click", ctx.click_handler);
},
m(target, anchor) {
insert(target, button, anchor);
6 years ago
insert(target, t1, anchor);
insert(target, p, anchor);
6 years ago
append(p, t2);
append(p, t3);
},
p(changed, ctx) {
6 years ago
if ((changed.things) && t3_value !== (t3_value = ctx.things.length)) {
set_data(t3, t3_value);
}
},
i: noop,
o: noop,
6 years ago
d(detaching) {
if (detaching) {
detach(button);
detach(t1);
detach(p);
}
dispose();
}
};
}
function instance($$self, $$props, $$invalidate) {
let things = [];
function click_handler() { things.push(1); $$invalidate('things', things) }
return { things, click_handler };
}
class Component extends SvelteComponent {
constructor(options) {
super();
6 years ago
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default Component;