You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/js/samples/bind-width-height/expected.js

64 lines
1.3 KiB

5 years ago
/* generated by Svelte vX.Y.Z */
6 years ago
import {
SvelteComponent,
6 years ago
add_render_callback,
add_resize_listener,
detach,
element,
init,
insert,
noop,
safe_not_equal
} from "svelte/internal";
6 years ago
function create_fragment(ctx) {
let div;
let div_resize_listener;
6 years ago
return {
6 years ago
c() {
6 years ago
div = element("div");
6 years ago
div.textContent = "some content";
add_render_callback(() => /*div_elementresize_handler*/ ctx[2].call(div));
6 years ago
},
6 years ago
m(target, anchor) {
insert(target, div, anchor);
div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[2].bind(div));
6 years ago
},
p: noop,
i: noop,
o: noop,
6 years ago
d(detaching) {
if (detaching) detach(div);
div_resize_listener();
6 years ago
}
6 years ago
};
}
function instance($$self, $$props, $$invalidate) {
let { w } = $$props;
let { h } = $$props;
6 years ago
function div_elementresize_handler() {
w = this.offsetWidth;
h = this.offsetHeight;
$$invalidate(0, w);
$$invalidate(1, h);
}
6 years ago
$$self.$$set = $$props => {
if ('w' in $$props) $$invalidate(0, w = $$props.w);
if ('h' in $$props) $$invalidate(1, h = $$props.h);
};
return [w, h, div_elementresize_handler];
}
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, { w: 0, h: 1 });
}
6 years ago
}
export default Component;