File tree Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
- import { onMount } from " svelte" ;
3
2
import { get } from " svelte/store" ;
3
+ import { browser } from " $app/environment" ;
4
4
import { localStorageStore } from " $lib/localStorageStore" ;
5
5
6
6
/**
10
10
11
11
let showPulse = false ;
12
12
13
- onMount (() => {
14
- if (storedDateItem ) {
15
- const storedDate = localStorageStore (storedDateItem , " " );
16
- const lastVisitItem = localStorage .getItem (" lastVisit" );
17
- if (storedDate && lastVisitItem ) {
18
- showPulse = new Date (get (storedDate )) > new Date (lastVisitItem );
19
- }
13
+ $ : if (storedDateItem && browser ) {
14
+ const storedDateStore = localStorageStore (storedDateItem , " " );
15
+ const storedDate = get (storedDateStore );
16
+ const lastVisitItem = localStorage .getItem (" lastVisit" );
17
+ if (storedDate && lastVisitItem ) {
18
+ showPulse = new Date (storedDate ) > new Date (lastVisitItem );
20
19
}
21
- });
20
+ }
22
21
</script >
23
22
24
23
{#if showPulse }
Original file line number Diff line number Diff line change 98
98
}
99
99
]
100
100
}
101
- } as const ;
102
- let currentRepo: keyof typeof repos = " svelte" ;
101
+ };
102
+ let currentRepo: Tab = " svelte" ;
103
103
104
104
/**
105
105
* Fetches releases from GitHub for the given category, for
108
108
* @param category The category of the repos to fetch
109
109
* @returns A promise that resolves to an array of flatten releases
110
110
*/
111
- async function octokitResponse(category : keyof typeof repos ) {
111
+ async function octokitResponse(category : Tab ) {
112
112
return Promise .all (
113
113
repos [category ].repos .map (({ repoName , dataFilter }) =>
114
114
octokit .rest .repos
134
134
}
135
135
136
136
// Badges
137
- let previousTab: string = currentRepo ;
138
- let visitedTabs: string [] = [];
137
+ let previousTab: Tab = currentRepo ;
138
+ let visitedTabs: Tab [] = [];
139
139
let loadedTabs: Tab [] = [];
140
140
let isLoadingDone = false ;
141
141
$ : if (loadedTabs .length === Object .keys (repos ).length ) {
252
252
253
253
// I have no clue how this can be undefined
254
254
if (newValue ) {
255
+ // @ts-expect-error Svelte 5, please
255
256
previousTab = newValue ;
256
257
}
257
258
}}
You can’t perform that action at this time.
0 commit comments