mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-15 20:34:44 +00:00
update tests
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
import { init, goto, prefetchRoutes } from '../../../runtime.js';
|
||||
import { Store } from 'svelte/store.js';
|
||||
import { manifest } from './manifest/client.js';
|
||||
import * as sapper from './__sapper__/client.js';
|
||||
|
||||
window.init = () => {
|
||||
return init({
|
||||
return sapper.start({
|
||||
target: document.querySelector('#sapper'),
|
||||
manifest,
|
||||
store: data => new Store(data)
|
||||
});
|
||||
};
|
||||
|
||||
window.prefetchRoutes = prefetchRoutes;
|
||||
window.goto = goto;
|
||||
window.prefetchRoutes = sapper.prefetchRoutes;
|
||||
window.goto = sapper.goto;
|
||||
@@ -9,17 +9,9 @@
|
||||
<button class='prefetch' on:click='prefetch("blog/why-the-name")'>Why the name?</button>
|
||||
|
||||
<script>
|
||||
import { goto, prefetch } from '../../../../runtime.js';
|
||||
import { prefetch } from '../__sapper__/client.js';
|
||||
|
||||
export default {
|
||||
oncreate() {
|
||||
window.goto = goto;
|
||||
},
|
||||
|
||||
ondestroy() {
|
||||
window.goto = null;
|
||||
},
|
||||
|
||||
methods: {
|
||||
prefetch
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ import fs from 'fs';
|
||||
import { resolve } from 'url';
|
||||
import express from 'express';
|
||||
import serve from 'serve-static';
|
||||
import sapper from '../../../dist/middleware.js';
|
||||
import { Store } from 'svelte/store.js';
|
||||
import { manifest } from './manifest/server.js';
|
||||
import * as sapper from './__sapper__/server.js';
|
||||
|
||||
let pending;
|
||||
let ended;
|
||||
@@ -92,8 +91,7 @@ const middlewares = [
|
||||
next();
|
||||
},
|
||||
|
||||
sapper({
|
||||
manifest,
|
||||
sapper.middleware({
|
||||
store: (req, res) => {
|
||||
return new Store({
|
||||
title: `${req.hello} ${res.locals.name}`
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { assets, shell, timestamp, routes } from './manifest/service-worker.js';
|
||||
import { files, shell, timestamp, routes } from './__sapper__/service-worker.js';
|
||||
|
||||
const ASSETS = `cachetimestamp`;
|
||||
|
||||
// `shell` is an array of all the files generated by webpack,
|
||||
// `assets` is an array of everything in the `assets` directory
|
||||
const to_cache = shell.concat(assets);
|
||||
const to_cache = shell.concat(files);
|
||||
const cached = new Set(to_cache);
|
||||
|
||||
self.addEventListener('install', event => {
|
||||
|
||||
Reference in New Issue
Block a user