mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
simplify
This commit is contained in:
parent
6a98febf5f
commit
db901725ae
@ -224,17 +224,12 @@ export default function dom(
|
||||
component.rewrite_props(({ name, reassigned, export_name }) => {
|
||||
const value = `$${name}`;
|
||||
|
||||
let insert: Node[];
|
||||
if (reassigned || export_name) {
|
||||
insert = b`${`$$subscribe_${name}`}()`;
|
||||
} else {
|
||||
const callback = x`$$value => $$invalidate('${value}', ${value} = $$value)`;
|
||||
|
||||
insert = b`@component_subscribe($$self, ${name}, $${callback})`;
|
||||
}
|
||||
const insert = (reassigned || export_name)
|
||||
? b`${`$$subscribe_${name}`}()`
|
||||
: b`@component_subscribe($$self, ${name}, #value => $$invalidate('${value}', ${value} = #value))`;
|
||||
|
||||
if (component.compile_options.dev) {
|
||||
insert = b`@validate_store(${name}, '${name}'); ${insert}`;
|
||||
return b`@validate_store(${name}, '${name}'); ${insert}`;
|
||||
}
|
||||
|
||||
return insert;
|
||||
|
Loading…
Reference in New Issue
Block a user