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

82 lines
1.5 KiB

6 years ago
/* generated by Svelte vX.Y.Z */
import { SvelteComponent as SvelteComponent_1, addResizeListener, add_render_callback, createElement, detachNode, flush, init, insert, noop, run, safe_not_equal } from "svelte/internal";
6 years ago
function create_fragment(component, ctx) {
var div, div_resize_listener, current;
6 years ago
return {
6 years ago
c() {
6 years ago
div = createElement("div");
div.textContent = "some content";
add_render_callback(() => ctx.div_resize_handler.call(div));
6 years ago
},
6 years ago
m(target, anchor) {
insert(target, div, anchor);
6 years ago
div_resize_listener = addResizeListener(div, ctx.div_resize_handler.bind(div));
current = true;
6 years ago
},
p: noop,
i(target, anchor) {
if (current) return;
this.m(target, anchor);
},
o: run,
6 years ago
d(detach) {
if (detach) {
detachNode(div);
}
6 years ago
6 years ago
div_resize_listener.cancel();
}
6 years ago
};
}
function instance($$self, $$props, $$invalidate) {
let { w, h } = $$props;
6 years ago
function div_resize_handler() {
w = this.offsetWidth;
h = this.offsetHeight;
$$invalidate('w', w);
$$invalidate('h', h);
}
6 years ago
$$self.$$.set = $$props => {
if ('w' in $$props) $$invalidate('w', w = $$props.w);
if ('h' in $$props) $$invalidate('h', h = $$props.h);
};
return { w, h, div_resize_handler };
}
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal);
}
get w() {
return this.$$.ctx.w;
}
set w(w) {
this.$set({ w });
flush();
}
get h() {
return this.$$.ctx.h;
}
6 years ago
set h(h) {
this.$set({ h });
flush();
6 years ago
}
}
export default SvelteComponent;