Merge pull request #1909 from sveltejs/gh-1898

use correct context for resize handler
pull/1913/head
Rich Harris 6 years ago committed by GitHub
commit fefe0a246f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -494,7 +494,7 @@ export default class ElementWrapper extends Wrapper {
block.addVariable(resize_listener); block.addVariable(resize_listener);
block.builders.mount.addLine( block.builders.mount.addLine(
`${resize_listener} = @addResizeListener(${this.var}, ${callee});` `${resize_listener} = @addResizeListener(${this.var}, ${callee}.bind(${this.var}));`
); );
block.builders.destroy.addLine( block.builders.destroy.addLine(

@ -13,7 +13,7 @@ function create_fragment(component, ctx) {
m(target, anchor) { m(target, anchor) {
insert(target, div, anchor); insert(target, div, anchor);
div_resize_listener = addResizeListener(div, ctx.div_resize_handler); div_resize_listener = addResizeListener(div, ctx.div_resize_handler.bind(div));
current = true; current = true;
}, },

Loading…
Cancel
Save