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-script-if-n.../expected.js

79 lines
1.3 KiB

5 years ago
/* 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) {
let button;
let t1;
let p;
let t2;
let t3;
let mounted;
let dispose;
return {
c() {
6 years ago
button = element("button");
button.textContent = "foo";
t1 = space();
6 years ago
p = element("p");
t2 = text("x: ");
t3 = text(/*x*/ ctx[0]);
},
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);
if (!mounted) {
dispose = listen(button, "click", /*foo*/ ctx[1]);
mounted = true;
}
},
p(ctx, [dirty]) {
if (dirty & /*x*/ 1) set_data(t3, /*x*/ ctx[0]);
},
i: noop,
o: noop,
6 years ago
d(detaching) {
if (detaching) detach(button);
if (detaching) detach(t1);
if (detaching) detach(p);
mounted = false;
dispose();
}
};
}
function instance($$self, $$props, $$invalidate) {
let x = 0;
function foo() {
if (true) $$invalidate(0, x += 1);
}
return [x, foo];
}
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, {});
}
}
export default Component;