use component.invalidate

pull/3835/head
Tan Li Hau 6 years ago
parent cbf8b13658
commit 3c57d967fe

@ -127,11 +127,7 @@ export default class WindowWrapper extends Wrapper {
component.partly_hoisted.push(b`
function ${id}() {
${props.map(prop =>
prop.name[0] === '$'
? b`${prop.name.slice(1)}.set(${prop.name} = @_window.${prop.value});`
: b`$$invalidate('${prop.name}', ${prop.name} = @_window.${prop.value});`
)}
${props.map(prop => component.invalidate(prop.name, x`${prop.name} = @_window.${prop.value}`))}
}
`);
@ -169,11 +165,9 @@ export default class WindowWrapper extends Wrapper {
referenced: true
});
const invalidate = name[0] === '$' ? b`${name.slice(1)}.set(${name} = @_navigator.onLine)` : b`$$invalidate('${name}', ${name} = @_navigator.onLine);`;
component.partly_hoisted.push(b`
function ${id}() {
${invalidate}
${component.invalidate(name, x`${name} = @_navigator.onLine`)}
}
`);

@ -111,7 +111,7 @@ function instance($$self, $$props, $$invalidate) {
component_subscribe($$self, y_squared, value => $$invalidate("$y_squared", $y_squared = value));
function onwindowscroll() {
y.set($y = window.pageYOffset);
y.set($y = window.pageYOffset)
}
return {

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

Loading…
Cancel
Save