mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-15 20:34:44 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9eca90067c | ||
|
|
57f293e872 | ||
|
|
7e65c481d8 | ||
|
|
0fe93cd177 | ||
|
|
67fe570f6d |
@@ -39,7 +39,7 @@ module.exports = function connect(opts) {
|
|||||||
await compiler.ready;
|
await compiler.ready;
|
||||||
res.set({
|
res.set({
|
||||||
'Content-Type': 'application/javascript',
|
'Content-Type': 'application/javascript',
|
||||||
'Cache-Control': 'max-age=600'
|
'Cache-Control': dev ? 'no-cache' : 'max-age=600'
|
||||||
});
|
});
|
||||||
res.end(compiler.service_worker);
|
res.end(compiler.service_worker);
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ module.exports = function connect(opts) {
|
|||||||
await compiler.ready;
|
await compiler.ready;
|
||||||
res.set({
|
res.set({
|
||||||
'Content-Type': 'text/html',
|
'Content-Type': 'text/html',
|
||||||
'Cache-Control': 'max-age=600'
|
'Cache-Control': dev ? 'no-cache' : 'max-age=600'
|
||||||
});
|
});
|
||||||
res.end(compiler.shell);
|
res.end(compiler.shell);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sapper",
|
"name": "sapper",
|
||||||
"version": "0.0.18",
|
"version": "0.0.20",
|
||||||
"description": "Combat-ready apps, engineered by Svelte",
|
"description": "Combat-ready apps, engineered by Svelte",
|
||||||
"main": "connect.js",
|
"main": "connect.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ const app = {
|
|||||||
scroll_history[cid] = { x: 0, y: 0 };
|
scroll_history[cid] = { x: 0, y: 0 };
|
||||||
|
|
||||||
history.pushState({ id }, '', url.href);
|
history.pushState({ id }, '', url.href);
|
||||||
event.preventDefault();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selected.route.load().then(mod => {
|
selected.route.load().then(mod => {
|
||||||
@@ -104,8 +103,6 @@ const app = {
|
|||||||
const a = findAnchor(event.target);
|
const a = findAnchor(event.target);
|
||||||
if (!a) return;
|
if (!a) return;
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
// check if link is inside an svg
|
// check if link is inside an svg
|
||||||
// in this case, both href and target are always inside an object
|
// in this case, both href and target are always inside an object
|
||||||
const svg = typeof a.href === 'object' && a.href.constructor.name === 'SVGAnimatedString';
|
const svg = typeof a.href === 'object' && a.href.constructor.name === 'SVGAnimatedString';
|
||||||
@@ -121,7 +118,9 @@ const app = {
|
|||||||
|
|
||||||
const scroll = scroll_state();
|
const scroll = scroll_state();
|
||||||
|
|
||||||
navigate(new URL(a.href), null);
|
if (navigate(new URL(a.href), null)) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function preload(event) {
|
function preload(event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user