use helper for combining window binding props

pull/1887/head
Rich Harris 6 years ago
parent d236a4ad0b
commit e5ae97b9c9

@ -3,6 +3,7 @@ import Block from '../Block';
import Node from '../../nodes/shared/Node';
import Wrapper from './shared/Wrapper';
import deindent from '../../../utils/deindent';
import stringifyProps from '../../../utils/stringifyProps';
const associatedEvents = {
innerWidth: 'resize',
@ -147,9 +148,7 @@ export default class WindowWrapper extends Wrapper {
`}
${component.options.dev && `component._updatingReadonlyProperty = true;`}
#component.set({
${props.map(prop => `${prop.name}: this.${prop.value},`)}
});
#component.set(${stringifyProps(props.map(prop => `${prop.name}: this.${prop.value}`))});
${component.options.dev && `component._updatingReadonlyProperty = false;`}
${event === 'scroll' && `${lock} = false;`}

@ -8,9 +8,7 @@ function create_main_fragment(component, ctx) {
if (window_updating) return;
window_updating = true;
component.set({
y: this.pageYOffset
});
component.set({ y: this.pageYOffset });
window_updating = false;
}
window.addEventListener("scroll", onwindowscroll);

Loading…
Cancel
Save