0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00
svelte/test/js/samples/setup-method/expected.js

50 lines
844 B
JavaScript
Raw Normal View History

/* generated by Svelte vX.Y.Z */
2017-09-16 21:09:38 +02:00
import { assign, init, noop, proto } from "svelte/shared.js";
2017-09-20 17:06:23 +02:00
var methods = {
foo ( bar ) {
console.log( bar );
}
};
function setup(Component) {
Component.SOME_CONSTANT = 42;
Component.factory = function (target) {
return new Component({
target: target
});
}
Component.prototype.foo( 'baz' );
}
2017-09-19 17:00:55 +02:00
function create_main_fragment(state, component) {
2017-09-19 17:00:55 +02:00
return {
2017-09-19 04:00:28 +02:00
c: noop,
2017-09-19 04:00:28 +02:00
m: noop,
2017-09-19 04:00:28 +02:00
p: noop,
2017-08-14 04:36:39 +02:00
2017-09-19 04:00:28 +02:00
u: noop,
2017-09-19 04:00:28 +02:00
d: noop
2017-09-19 17:00:55 +02:00
};
}
2017-09-19 17:00:55 +02:00
function SvelteComponent(options) {
init(this, options);
this._state = options.data || {};
2017-09-19 17:00:55 +02:00
this._fragment = create_main_fragment(this._state, this);
2017-09-19 17:00:55 +02:00
if (options.target) {
2017-09-19 04:00:28 +02:00
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
}
2017-09-19 17:00:55 +02:00
}
2017-09-20 17:06:23 +02:00
assign(SvelteComponent.prototype, methods, proto);
2017-09-20 17:06:23 +02:00
setup(SvelteComponent);
2017-09-19 17:00:55 +02:00
export default SvelteComponent;