budibase/packages/client/src/components/ClientApp.svelte

33 lines
763 B
Svelte
Raw Normal View History

<script>
import { writable } from "svelte/store"
import { setContext, onMount } from "svelte"
import Component from "./Component.svelte"
2021-01-27 18:29:30 +01:00
import NotificationDisplay from "./NotificationDisplay.svelte"
import SDK from "../sdk"
2021-01-27 18:29:30 +01:00
import {
createDataStore,
initialise,
screenStore,
notificationStore,
} from "../store"
// Provide contexts
setContext("sdk", SDK)
setContext("component", writable({}))
setContext("data", createDataStore())
setContext("screenslot", false)
let loaded = false
// Load app config
onMount(async () => {
await initialise()
loaded = true
})
</script>
{#if loaded && $screenStore.activeLayout}
<Component definition={$screenStore.activeLayout.props} />
{/if}
2021-01-27 18:29:30 +01:00
<NotificationDisplay />