Make inject_state and capture_state always available

pull/3126/head
Axelen123 6 years ago
parent d64521cf42
commit f06bc2fff7
No known key found for this signature in database
GPG Key ID: 7B3388EF6070C533

@ -156,7 +156,11 @@ export default function dom(
() => { () => {
return { ${component.vars.filter(prop => prop.writable).map(prop => prop.name).join(", ")} }; return { ${component.vars.filter(prop => prop.writable).map(prop => prop.name).join(", ")} };
} }
` : null; ` : deindent`
() => {
return {}
}
`;
inject_state = (uses_props || writable_props.length > 0) ? deindent` inject_state = (uses_props || writable_props.length > 0) ? deindent`
${$$props} => { ${$$props} => {
@ -165,7 +169,11 @@ export default function dom(
if ('${prop.name}' in $$props) ${component.invalidate(prop.name, `${prop.name} = ${$$props}.${prop.name}`)}; if ('${prop.name}' in $$props) ${component.invalidate(prop.name, `${prop.name} = ${$$props}.${prop.name}`)};
`)} `)}
} }
` : null; ` : deindent`
${$$props} => {
return
}
`;
} }
// instrument assignments // instrument assignments

Loading…
Cancel
Save