pull/3548/head
daszgfz 6 years ago
parent b9f7c51ad4
commit 97c15b5f49

@ -228,7 +228,7 @@ export default function dom(
return b`${`$$subscribe_${name}`}()`; return b`${`$$subscribe_${name}`}()`;
} }
const callback = x`$$value => { $$invalidate('${value}', ${value} = $$value) }`; const callback = x`$$value => $$invalidate('${value}', ${value} = $$value)`;
let insert = b`@component_subscribe($$self, ${name}, $${callback})`; let insert = b`@component_subscribe($$self, ${name}, $${callback})`;
if (component.compile_options.dev) { if (component.compile_options.dev) {
@ -356,7 +356,7 @@ export default function dom(
if (store && store.reassigned) { if (store && store.reassigned) {
const unsubscribe = `$$unsubscribe_${name}`; const unsubscribe = `$$unsubscribe_${name}`;
const subscribe = `$$subscribe_${name}`; const subscribe = `$$subscribe_${name}`;
return b`let ${$name}, ${unsubscribe} = @noop, ${subscribe} = () => (${unsubscribe}(), ${unsubscribe} = @subscribe(${name}, $$value => { $$invalidate('${$name}', ${$name} = $$value); }), ${name})`; return b`let ${$name}, ${unsubscribe} = @noop, ${subscribe} = () => (${unsubscribe}(), ${unsubscribe} = @subscribe(${name}, $$value => $$invalidate('${$name}', ${$name} = $$value)), ${name})`;
} }
return b`let ${$name};`; return b`let ${$name};`;

@ -1,4 +1,3 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,
@ -12,44 +11,37 @@ import {
set_data, set_data,
text text
} from "svelte/internal"; } from "svelte/internal";
import { writable } from "svelte/store"; import { writable } from "svelte/store";
function create_fragment(ctx) { function create_fragment(ctx) {
var h1, t; let h1;
let t;
return { return {
c() { c() {
h1 = element("h1"); h1 = element("h1");
t = text(ctx.$foo); t = text(ctx.$foo);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, h1, anchor); insert(target, h1, anchor);
append(h1, t); append(h1, t);
}, },
p(changed, ctx) { p(changed, ctx) {
if (changed.$foo) { if (changed.$foo) set_data(t, ctx.$foo);
set_data(t, ctx.$foo);
}
}, },
i: noop, i: noop,
o: noop, o: noop,
d(detaching) { d(detaching) {
if (detaching) { if (detaching) detach(h1);
detach(h1);
}
} }
}; };
} }
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let $foo; let $foo;
const foo = writable(0);
const foo = writable(0); component_subscribe($$self, foo, $$value => $$invalidate('$foo', $foo = $$value)); component_subscribe($$self, foo, $$value => $$invalidate("$foo", $foo = $$value));
return { foo, $foo }; return { foo, $foo };
} }

@ -1,4 +1,3 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
component_subscribe, component_subscribe,
@ -7,6 +6,7 @@ import {
safe_not_equal, safe_not_equal,
set_store_value set_store_value
} from "svelte/internal"; } from "svelte/internal";
import { count } from "./store.js"; import { count } from "./store.js";
function create_fragment(ctx) { function create_fragment(ctx) {
@ -22,8 +22,7 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let $count; let $count;
component_subscribe($$self, count, $$value => $$invalidate("$count", $count = $$value));
component_subscribe($$self, count, $$value => $$invalidate('$count', $count = $$value));
function increment() { function increment() {
set_store_value(count, $count++, $count); set_store_value(count, $count++, $count);

@ -1,4 +1,3 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,
@ -14,10 +13,15 @@ import {
subscribe, subscribe,
text text
} from "svelte/internal"; } from "svelte/internal";
import { writable } from "svelte/store"; import { writable } from "svelte/store";
function create_fragment(ctx) { function create_fragment(ctx) {
var h1, t0, t1, button, dispose; let h1;
let t0;
let t1;
let button;
let dispose;
return { return {
c() { c() {
@ -28,44 +32,35 @@ function create_fragment(ctx) {
button.textContent = "reset"; button.textContent = "reset";
dispose = listen(button, "click", ctx.click_handler); dispose = listen(button, "click", ctx.click_handler);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, h1, anchor); insert(target, h1, anchor);
append(h1, t0); append(h1, t0);
insert(target, t1, anchor); insert(target, t1, anchor);
insert(target, button, anchor); insert(target, button, anchor);
}, },
p(changed, ctx) { p(changed, ctx) {
if (changed.$foo) { if (changed.$foo) set_data(t0, ctx.$foo);
set_data(t0, ctx.$foo);
}
}, },
i: noop, i: noop,
o: noop, o: noop,
d(detaching) { d(detaching) {
if (detaching) { if (detaching) detach(h1);
detach(h1); if (detaching) detach(t1);
detach(t1); if (detaching) detach(button);
detach(button);
}
dispose(); dispose();
} }
}; };
} }
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let $foo, $$unsubscribe_foo = noop, $$subscribe_foo = () => ($$unsubscribe_foo(), $$unsubscribe_foo = subscribe(foo, $$value => $$invalidate('$foo', $foo = $$value)), foo); let $foo,
$$unsubscribe_foo = noop,
$$subscribe_foo = () => ($$unsubscribe_foo(), $$unsubscribe_foo = subscribe(foo, $$value => $$invalidate("$foo", $foo = $$value)), foo);
$$self.$$.on_destroy.push(() => $$unsubscribe_foo()); $$self.$$.on_destroy.push(() => $$unsubscribe_foo());
let foo = writable(0);
let foo = writable(0); $$subscribe_foo(); $$subscribe_foo();
const click_handler = () => $$subscribe_foo($$invalidate("foo", foo = writable(0)));
const click_handler = () => $$subscribe_foo($$invalidate('foo', foo = writable(0)));
return { foo, $foo, click_handler }; return { foo, $foo, click_handler };
} }

@ -1,4 +1,3 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
add_render_callback, add_render_callback,
@ -10,8 +9,7 @@ import {
} from "svelte/internal"; } from "svelte/internal";
function create_fragment(ctx) { function create_fragment(ctx) {
var dispose; let dispose;
add_render_callback(ctx.onlinestatuschanged); add_render_callback(ctx.onlinestatuschanged);
return { return {
@ -21,12 +19,10 @@ function create_fragment(ctx) {
listen(window, "offline", ctx.onlinestatuschanged) listen(window, "offline", ctx.onlinestatuschanged)
]; ];
}, },
m: noop, m: noop,
p: noop, p: noop,
i: noop, i: noop,
o: noop, o: noop,
d(detaching) { d(detaching) {
run_all(dispose); run_all(dispose);
} }
@ -37,7 +33,7 @@ function instance($$self, $$props, $$invalidate) {
let online; let online;
function onlinestatuschanged() { function onlinestatuschanged() {
$$invalidate('online', online = navigator.onLine); $$invalidate("online", online = navigator.onLine);
} }
return { online, onlinestatuschanged }; return { online, onlinestatuschanged };

Loading…
Cancel
Save