Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commitc34a754

Browse files
author
Rich Harris
committed
Merge branch 'main' of github.com:sveltejs/learn.svelte.dev
2 parents517ae81 +cbcf166 commitc34a754

File tree

7 files changed

+5
-42
lines changed

7 files changed

+5
-42
lines changed

‎content/tutorial/01-svelte/08-stores/02-auto-subscriptions/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Start by declaring `unsubscribe` in `App.svelte`:
1515

1616
>Calling a`subscribe` method returns an`unsubscribe` function.
1717
18-
You now declared`unsubscribe`, but it still needs to be called, for example through the`onDestroy`[lifecycle hook](/tutorial/ondestroy):
18+
You now declared`unsubscribe`, but it still needs to be called, for example through the`onDestroy` lifecycle hook:
1919

2020
```svelte
2121
/// file: App.svelte

‎content/tutorial/04-advanced-sveltekit/03-advanced-routing/04-route-groups/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { redirect } from '@sveltejs/kit';
1616

1717
exportfunctionload({ cookies, url }) {
1818
if (!cookies.get('logged_in')) {
19-
throwredirect(307,`/login?redirectTo=${url.pathname}`);
19+
throwredirect(303,`/login?redirectTo=${url.pathname}`);
2020
}
2121
}
2222
```

‎content/tutorial/04-advanced-sveltekit/03-advanced-routing/04-route-groups/app-a/src/routes/login/+page.server.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { redirect } from '@sveltejs/kit';
33
exportconstactions={
44
default:({ cookies, url})=>{
55
cookies.set('logged_in','true',{path:'/'});
6-
throwredirect(307,url.searchParams.get('redirectTo')??'/');
6+
throwredirect(303,url.searchParams.get('redirectTo')??'/');
77
}
88
};

‎content/tutorial/04-advanced-sveltekit/03-advanced-routing/04-route-groups/app-a/src/routes/logout/+page.server.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { redirect } from '@sveltejs/kit';
33
exportconstactions={
44
default:({ cookies})=>{
55
cookies.delete('logged_in',{path:'/'});
6-
throwredirect(307,'/');
6+
throwredirect(303,'/');
77
}
88
};

‎content/tutorial/04-advanced-sveltekit/03-advanced-routing/04-route-groups/app-b/src/routes/(authed)/+layout.server.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { redirect } from '@sveltejs/kit';
22

33
exportfunctionload({ cookies, url}){
44
if(!cookies.get('logged_in')){
5-
throwredirect(307,`/login?redirectTo=${url.pathname}`);
5+
throwredirect(303,`/login?redirectTo=${url.pathname}`);
66
}
77
}

‎content/tutorial/common/src/__client.js‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
// Hack into the alert that's used in some tutorials and send a message prior to the alert,
2-
// else the parent thinks we lost contact and wrongfully reloads the page.
3-
// The drawback is that alert is no longer blocking, but no tutorial relies on this.
4-
constalert=window.alert;
5-
window.alert=(message)=>{
6-
parent.postMessage(
7-
{
8-
type:'ping-pause'
9-
},
10-
'*'
11-
);
12-
setTimeout(()=>{
13-
alert(message);
14-
});
15-
};
16-
171
window.addEventListener('message',async(e)=>{
182
if(e.data.type==='fetch'){
193
constnames=e.data.names;
@@ -121,7 +105,6 @@ function ping() {
121105
);
122106
}
123107

124-
setInterval(ping,100);
125108
ping();
126109

127110
if(import.meta.hot){

‎src/routes/tutorial/[slug]/Output.svelte‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,14 @@
3434
};
3535
});
3636
37-
afterNavigate(()=> {
38-
clearTimeout(timeout);
39-
});
40-
41-
/**@type{any}*/
42-
let timeout;
43-
4437
/**@param{MessageEvent}e*/
4538
asyncfunctionhandle_message(e) {
4639
if (e.origin!== $base)return;
4740
4841
if (paused)return;
4942
5043
if (e.data.type==='ping') {
51-
path=e.data.data.path?? path;
5244
loading=false;
53-
54-
clearTimeout(timeout);
55-
timeout=setTimeout(()=> {
56-
if (dev&&!iframe)return;
57-
58-
// we lost contact, refresh the page
59-
loading=true;
60-
set_iframe_src($base+ path);
61-
loading=false;
62-
},1000);
63-
}elseif (e.data.type==='ping-pause') {
64-
clearTimeout(timeout);
6545
}elseif (e.data.type==='warnings') {
6646
warnings.update(($warnings)=> ({
6747
...$warnings,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp