give each app its own page, preloading and session stores, using context

This commit is contained in:
Rich Harris
2019-04-29 14:52:19 -04:00
parent 9c48e32a45
commit afeedf6bb2
17 changed files with 54 additions and 49 deletions

View File

@@ -1,5 +1,6 @@
<script>
import { page } from '@sapper/app';
import { stores } from '@sapper/app';
const { page } = stores();
</script>
<h1>{$page.params.rest.join(',')}</h1>

View File

@@ -1,5 +1,6 @@
<script>
import { page } from '@sapper/app';
import { stores } from '@sapper/app';
const { page } = stores();
</script>
<h1>{$page.params.rest.join(',')}</h1>

View File

@@ -1,5 +1,6 @@
<script>
import { page } from '@sapper/app';
import { stores } from '@sapper/app';
const { page } = stores();
</script>
<h1>{$page.params.slug.toUpperCase()}</h1>

View File

@@ -1,5 +1,6 @@
<script>
import { page } from '@sapper/app';
import { stores } from '@sapper/app';
const { page } = stores();
</script>
<h1>{JSON.stringify($page.query)}</h1>

View File

@@ -7,7 +7,10 @@
</script>
<script>
import { page } from '@sapper/app';
import { stores } from '@sapper/app';
const { page } = stores();
export let slug;
</script>

View File

@@ -9,7 +9,8 @@
</script>
<script>
import { page } from '@sapper/app';
import { stores } from '@sapper/app';
const { page } = stores();
export let count;
</script>

View File

@@ -9,7 +9,8 @@
</script>
<script>
import { page } from '@sapper/app';
import { stores } from '@sapper/app';
const { page } = stores();
export let count;
export let segment;

View File

@@ -7,12 +7,14 @@
</script>
<script>
import { preloading } from '@sapper/app';
import { stores } from '@sapper/app';
import { setContext } from 'svelte';
export let child;
export let rootPreloadFunctionRan;
const { preloading } = stores();
setContext('x', { rootPreloadFunctionRan });
</script>

View File

@@ -1,5 +1,6 @@
<script>
import { page } from '@sapper/app';
import { stores } from '@sapper/app';
const { page } = stores();
</script>
<h1>{$page.params.slug}</h1>

View File

@@ -5,8 +5,8 @@
</script>
<script>
import { getSession } from '@sapper/app';
const session = getSession();
import { stores } from '@sapper/app';
const { session } = stores();
export let title;
</script>

View File

@@ -1,6 +1,6 @@
<script>
import { getSession } from '@sapper/app';
const session = getSession();
import { stores } from '@sapper/app';
const { session } = stores();
</script>
<h1>{$session.title}</h1>