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/dev-warning-missing-data-co.../expected.js

90 lines
1.9 KiB

/* generated by Svelte vX.Y.Z */
import { SvelteComponentDev, addLoc, append, createElement, createText, detachNode, flush, init, insert, noop, safe_not_equal, setData } from "svelte/internal";
const file = undefined;
function create_fragment(ctx) {
var p, text0_value = Math.max(0, ctx.foo), text0, text1, text2;
return {
c: function create() {
p = createElement("p");
text0 = createText(text0_value);
text1 = createText("\n\t");
text2 = createText(ctx.bar);
addLoc(p, file, 7, 0, 67);
},
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
insert(target, p, anchor);
append(p, text0);
append(p, text1);
append(p, text2);
},
p: function update(changed, ctx) {
if ((changed.foo) && text0_value !== (text0_value = Math.max(0, ctx.foo))) {
setData(text0, text0_value);
}
if (changed.bar) {
setData(text2, ctx.bar);
}
},
i: noop,
o: noop,
6 years ago
d: function destroy(detach) {
if (detach) {
detachNode(p);
}
}
};
}
function instance($$self, $$props, $$invalidate) {
let { foo } = $$props;
6 years ago
let bar;
6 years ago
$$self.$set = $$props => {
if ('foo' in $$props) $$invalidate('foo', foo = $$props.foo);
};
6 years ago
$$self.$$.update = ($$dirty = { foo: 1 }) => {
if ($$dirty.foo) {
bar = foo * 2; $$invalidate('bar', bar);
}
};
return { foo, bar };
}
class SvelteComponent extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance, create_fragment, safe_not_equal);
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.foo === undefined && !('foo' in props)) {
console.warn("<SvelteComponent> was created without expected prop 'foo'");
}
}
get foo() {
return this.$$.ctx.foo;
}
set foo(foo) {
this.$set({ foo });
flush();
}
}
export default SvelteComponent;