mirror of https://github.com/sveltejs/svelte
parent
afe06059bf
commit
697e7335d1
@ -0,0 +1,50 @@
|
|||||||
|
/* generated by Svelte vX.Y.Z */
|
||||||
|
import {
|
||||||
|
SvelteComponent,
|
||||||
|
detach,
|
||||||
|
element,
|
||||||
|
init,
|
||||||
|
insert,
|
||||||
|
noop,
|
||||||
|
safe_not_equal
|
||||||
|
} from "svelte/internal";
|
||||||
|
|
||||||
|
import { bar } from "./utils.js";
|
||||||
|
|
||||||
|
function create_fragment(ctx) {
|
||||||
|
let p;
|
||||||
|
|
||||||
|
return {
|
||||||
|
c() {
|
||||||
|
p = element("p");
|
||||||
|
p.textContent = `You'll be pleased to know the answer is ${/*foo*/ ctx[0]()}.`;
|
||||||
|
},
|
||||||
|
m(target, anchor) {
|
||||||
|
insert(target, p, anchor);
|
||||||
|
},
|
||||||
|
p: noop,
|
||||||
|
i: noop,
|
||||||
|
o: noop,
|
||||||
|
d(detaching) {
|
||||||
|
if (detaching) detach(p);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function instance($$self) {
|
||||||
|
function foo() {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
|
||||||
|
bar(foo);
|
||||||
|
return [foo];
|
||||||
|
}
|
||||||
|
|
||||||
|
class Component extends SvelteComponent {
|
||||||
|
constructor(options) {
|
||||||
|
super();
|
||||||
|
init(this, options, instance, create_fragment, safe_not_equal, {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Component;
|
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
import { bar } from './utils.js';
|
||||||
|
|
||||||
|
function foo() {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
|
||||||
|
bar(foo);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>You'll be pleased to know the answer is {foo()}.</p>
|
@ -0,0 +1,3 @@
|
|||||||
|
export function bar(fn) {
|
||||||
|
console.log(`I'm safe but you'd never know, ${fn}!`);
|
||||||
|
}
|
Loading…
Reference in new issue