mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Debounce loading on navigation if longer than 250ms.
This commit is contained in:
parent
31ec4c981b
commit
10cd1d0081
1 changed files with 12 additions and 3 deletions
|
|
@ -1,5 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { browser } from '$app/env';
|
||||
import { navigating } from '$app/stores';
|
||||
import debounce from 'just-debounce-it';
|
||||
import { Toy } from '@leveluptuts/svelte-toy';
|
||||
import Header from '$lib/components/header/Header.svelte';
|
||||
import Loading from '$lib/components/loading.svelte';
|
||||
|
|
@ -9,11 +11,18 @@
|
|||
import { collectionStore } from '$lib/stores/collectionStore';
|
||||
import { gameStore } from '$lib/stores/gameSearchStore';
|
||||
import { toast } from '$lib/components/toast/toast';
|
||||
// import 'carbon-components-svelte/css/all.css';
|
||||
import '$root/styles/styles.scss';
|
||||
import Toast from '$lib/components/toast/Toast.svelte';
|
||||
import '$root/styles/styles.scss';
|
||||
|
||||
$: {
|
||||
if ($navigating) {
|
||||
debounce(() => boredState.set({ loading: true }), 250);
|
||||
}
|
||||
if (!$navigating) {
|
||||
boredState.set({ loading: false });
|
||||
}
|
||||
}
|
||||
|
||||
console.log('browser', browser);
|
||||
if (browser) {
|
||||
let collectionEmpty = $collectionStore.length === 0 || false;
|
||||
console.log('collectionEmpty', collectionEmpty);
|
||||
|
|
|
|||
Loading…
Reference in a new issue