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

105 lines
2.3 KiB

/* generated by Svelte vX.Y.Z */
6 years ago
import {
SvelteComponentDev,
add_location,
append,
detach,
element,
init,
insert,
noop,
safe_not_equal,
set_data,
space,
6 years ago
text
} from "svelte/internal";
const file = undefined;
function create_fragment(ctx) {
6 years ago
var p, t0_value = Math.max(0, ctx.foo), t0, t1, t2;
return {
c: function create() {
6 years ago
p = element("p");
t0 = text(t0_value);
t1 = space();
6 years ago
t2 = text(ctx.bar);
add_location(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);
6 years ago
append(p, t0);
append(p, t1);
append(p, t2);
},
p: function update(changed, ctx) {
6 years ago
if ((changed.foo) && t0_value !== (t0_value = Math.max(0, ctx.foo))) {
set_data(t0, t0_value);
}
if (changed.bar) {
6 years ago
set_data(t2, ctx.bar);
}
},
i: noop,
o: noop,
6 years ago
d: function destroy(detaching) {
if (detaching) {
detach(p);
7 years ago
}
}
};
}
function instance($$self, $$props, $$invalidate) {
let { foo } = $$props;
6 years ago
let bar;
6 years ago
const writable_props = ['foo'];
Object.keys($$props).forEach(key => {
6 years ago
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<Component> was created with unknown prop '${key}'`);
});
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) { $$invalidate('bar', bar = foo * 2); }
};
return { foo, bar };
}
class Component extends SvelteComponentDev {
constructor(options) {
super(options);
6 years ago
init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.foo === undefined && !('foo' in props)) {
console.warn("<Component> was created without expected prop 'foo'");
}
}
6 years ago
get foo() {
throw new Error("<Component>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
6 years ago
}
set foo(value) {
throw new Error("<Component>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
6 years ago
}
}
6 years ago
export default Component;