<script lang="ts">
import { onMount, setContext } from "svelte";
import { firebaseStore } from "../stores/firebase_store";
import {Child} from "../components/Child.svelte";
setContext("firebaseStore", firebaseStore);
onMount(async () => {
const module = await import("firebase/app");
await import("firebase/auth");
await import("firebase/analytics");
const firebase = module.default;
const firebaseConfig = {
apiKey: "*",
authDomain: "*",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: "",
};
firebase.initializeApp(firebaseConfig);
firebase.analytics();
$firebaseStore = firebase;
});
</script>
<div>
<slot/>
<Child/>
</div>
<script lang="ts>
import { onMount, getContext } from "svelte";
let firebaseStore: any = getContext("firebaseStore");
$: firebase = $firebaseStore;
<div>child component</div>
</script>
import { writable } from "svelte/store";
export const firebaseStore = writable(null);