finish inlining $$invalidate

pull/3548/head
daszgfz 6 years ago
parent a2cd1fec7f
commit ac34d5aa43

@ -208,7 +208,7 @@ export default function dom(
component.rewrite_props(({ name, reassigned }) => { component.rewrite_props(({ name, reassigned }) => {
const value = `$${name}`; const value = `$${name}`;
const callback = `$value => { ${value} = $$value; $$invalidate('${value}', ${value}) }`; const callback = `$value => $$invalidate('${value}', ${value} = $$value)`;
if (reassigned) { if (reassigned) {
return `$$subscribe_${name}()`; return `$$subscribe_${name}()`;
@ -290,7 +290,7 @@ export default function dom(
}) })
.map(({ name }) => deindent` .map(({ name }) => deindent`
${component.compile_options.dev && `@validate_store(${name.slice(1)}, '${name.slice(1)}');`} ${component.compile_options.dev && `@validate_store(${name.slice(1)}, '${name.slice(1)}');`}
@component_subscribe($$self, ${name.slice(1)}, $$value => { ${name} = $$value; $$invalidate('${name}', ${name}); }); @component_subscribe($$self, ${name.slice(1)}, $$value => $$invalidate('${name}', ${name} = $$value));
`); `);
const resubscribable_reactive_store_unsubscribers = reactive_stores const resubscribable_reactive_store_unsubscribers = reactive_stores
@ -337,7 +337,7 @@ export default function dom(
const store = component.var_lookup.get(name); const store = component.var_lookup.get(name);
if (store && store.reassigned) { if (store && store.reassigned) {
return `${$name}, $$unsubscribe_${name} = @noop, $$subscribe_${name} = () => ($$unsubscribe_${name}(), $$unsubscribe_${name} = @subscribe(${name}, $$value => { ${$name} = $$value; $$invalidate('${$name}', ${$name}); }), ${name})`; return `${$name}, $$unsubscribe_${name} = @noop, $$subscribe_${name} = () => ($$unsubscribe_${name}(), $$unsubscribe_${name} = @subscribe(${name}, $$value => $$invalidate('${$name}', ${$name} = $$value)), ${name})`;
} }
return $name; return $name;

@ -126,7 +126,7 @@ export default class WindowWrapper extends Wrapper {
component.partly_hoisted.push(deindent` component.partly_hoisted.push(deindent`
function ${handler_name}() { function ${handler_name}() {
${props.map(prop => `${prop.name} = @_window.${prop.value}; $$invalidate('${prop.name}', ${prop.name});`)} ${props.map(prop => `$$invalidate('${prop.name}', ${prop.name} = @_window.${prop.value});`)}
} }
`); `);
@ -170,7 +170,7 @@ export default class WindowWrapper extends Wrapper {
component.partly_hoisted.push(deindent` component.partly_hoisted.push(deindent`
function ${handler_name}() { function ${handler_name}() {
${name} = @_navigator.onLine; $$invalidate('${name}', ${name}); $$invalidate('${name}', ${name} = @_navigator.onLine);
} }
`); `);

@ -37,7 +37,7 @@ function instance($$self, $$props, $$invalidate) {
let online; let online;
function onlinestatuschanged() { function onlinestatuschanged() {
online = navigator.onLine; $$invalidate('online', online); $$invalidate('online', online = navigator.onLine);
} }
return { online, onlinestatuschanged }; return { online, onlinestatuschanged };

@ -68,7 +68,7 @@ function instance($$self, $$props, $$invalidate) {
let { y } = $$props; let { y } = $$props;
function onwindowscroll() { function onwindowscroll() {
y = window.pageYOffset; $$invalidate('y', y); $$invalidate('y', y = window.pageYOffset);
} }
$$self.$set = $$props => { $$self.$set = $$props => {

Loading…
Cancel
Save