Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79c2658

Browse files
committed
add referece to main in stores and clean main contents
1 parent c6a99e8 commit 79c2658

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

pyscriptjs/src/Main.svelte

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,31 @@
22
import Fa from 'svelte-fa';
33
import { faWandMagic, faPlusCircle, faInfoCircle } from '@fortawesome/free-solid-svg-icons'
44
import SideNav from "./SideNav.svelte";
5+
import { onMount } from 'svelte';
6+
7+
import { mainDiv } from './stores';
8+
9+
// reference to the main application div
10+
let main;
11+
onMount(() => {
12+
// set the mainDiv in stores to point to the main div, after it has been mounted
13+
mainDiv.set(main);
14+
});
515
616
</script>
717

818
<div class="flex content-between flex-wrap min-h-full flex-grow">
9-
<main class="w-full p-6">
19+
<main class="w-full p-6" bind:this={main}>
1020
<div role="alert" class="w-full p-2 rounded-full bg-teal-light text-teal-darker text-lg">
11-
<py-script auto-generate target="page:mydiv" source='./mycode.py'>
12-
sum([1, 2, 3, 4, 5])
13-
</py-script>
1421
</div>
1522
</main>
1623

1724
<footer class="w-full p-6 bg-black text-white flex space-between">
1825
<p class="logo-title text-center">PyScript</p>
19-
<p class="w-full ml-6 text-center sm:text-left">Copyright &copy; 2019</p>
26+
<p class="w-full ml-6 text-center sm:text-left">Copyright &copy; 2022</p>
2027

2128
<aside class="w-full sm:w-auto text-center sm:text-right">
22-
<a href="https://github.com/SlawomirChabowski" title="My Github page" class="text-white block">
29+
<a href="https://pyscript.com" title="PyScript" class="text-white block">
2330
<Fa icon={faInfoCircle} style="transform: scale(2);"/>
2431
</a>
2532
</aside>

0 commit comments

Comments
 (0)