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/unreferenced-state-not-inva.../expected.js

76 lines
1.1 KiB

/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
append,
detach,
element,
init,
insert,
noop,
safe_not_equal,
set_data,
text
} from "svelte/internal";
import { onMount } from 'svelte';
function create_fragment(ctx) {
let p;
let t;
return {
c() {
p = element("p");
t = text(/*y*/ ctx[0]);
},
m(target, anchor) {
insert(target, p, anchor);
append(p, t);
},
p(ctx, [dirty]) {
if (dirty & /*y*/ 1) set_data(t, /*y*/ ctx[0]);
},
i: noop,
o: noop,
d(detaching) {
if (detaching) detach(p);
}
};
}
function instance($$self, $$props, $$invalidate) {
let x;
let y;
let a = 1, b = 2, c = 3;
onMount(() => {
const interval = setInterval(
() => {
$$invalidate(1, b += 1);
c += 1;
console.log(b, c);
},
1000
);
return () => clearInterval(interval);
});
$$self.$$.update = () => {
if ($$self.$$.dirty & /*b*/ 2) {
$: $$invalidate(0, y = b * 2);
}
};
$: x = a * 2;
return [y, b];
}
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, {});
}
}
export default Component;