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/each-block-array-literal/expected.js

84 lines
1.5 KiB

/* generated by Svelte vX.Y.Z */
import { SvelteComponent as SvelteComponent_1, append, createComment, createElement, createText, destroyEach, detachNode, init, insert, noop, safe_not_equal } from "svelte/internal";
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.num = list[i];
return child_ctx;
}
// (1:0) {#each [1, 2, 3, 4, 5] as num}
function create_each_block(ctx) {
var span, text;
return {
c() {
span = createElement("span");
text = createText(ctx.num);
},
m(target, anchor) {
insert(target, span, anchor);
append(span, text);
},
p: noop,
d(detach) {
if (detach) {
detachNode(span);
}
}
};
}
function create_fragment(ctx) {
var each_anchor;
var each_value = [1, 2, 3, 4, 5];
var each_blocks = [];
for (var i = 0; i < 5; i += 1) {
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
}
return {
c() {
for (var i = 0; i < 5; i += 1) {
each_blocks[i].c();
}
each_anchor = createComment();
},
m(target, anchor) {
for (var i = 0; i < 5; i += 1) {
each_blocks[i].m(target, anchor);
}
insert(target, each_anchor, anchor);
},
p: noop,
i: noop,
o: noop,
d(detach) {
destroyEach(each_blocks, detach);
if (detach) {
detachNode(each_anchor);
}
}
};
}
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal);
}
}
export default SvelteComponent;