Support Svelte 3

fixes #546, #551, #552, #554
This commit is contained in:
Rich Harris
2019-02-03 14:29:47 -05:00
committed by GitHub
parent 83c8d7f855
commit ca034d0857
139 changed files with 1946 additions and 2016 deletions

View File

@@ -1,19 +1,21 @@
<h1>{post.title}</h1>
<script context="module">
export function preload({ params }) {
const { slug } = params;
return this.fetch(`blog/${slug}.json`).then(r => {
return r.json().then(data => {
if (r.status !== 200) {
this.error(r.status, data);
}
return data;
});
});
}
</script>
<script>
export default {
preload({ params }) {
const { slug } = params;
export let post;
</script>
return this.fetch(`blog/${slug}.json`).then(r => {
return r.json().then(data => {
if (r.status !== 200) {
this.error(r.status, data);
}
return data;
});
});
}
};
</script>
<h1>{post.title}</h1>

View File

@@ -1,7 +1,5 @@
<script>
export default {
preload() {
this.error(420, 'Enhance your calm');
}
};
<script context="module">
export function preload() {
this.error(420, 'Enhance your calm');
}
</script>

View File

@@ -1,7 +1,5 @@
<script>
export default {
preload() {
throw new Error('nope');
}
};
<script context="module">
export function preload() {
throw new Error('nope');
}
</script>