Spaces:
Paused
Paused
Download src/lib/components/common/Loader.svelte from ArcanePulse/open-webui: direct link, hf CLI and curl.
- Browser
- Download file 668 Bytes
-
https://huggingface.co/spaces/ArcanePulse/open-webui/resolve/main/src/lib/components/common/Loader.svelte
- Command line
-
hf download hf://spaces/ArcanePulse/open-webui/src/lib/components/common/Loader.svelte
-
curl -L -o Loader.svelte https://huggingface.co/spaces/ArcanePulse/open-webui/resolve/main/src/lib/components/common/Loader.svelte
668 Bytes
| <script lang="ts"> | |
| import { createEventDispatcher, onMount } from 'svelte'; | |
| const dispatch = createEventDispatcher(); | |
| let loaderElement: HTMLElement; | |
| onMount(() => { | |
| const observer = new IntersectionObserver( | |
| (entries, observer) => { | |
| entries.forEach((entry) => { | |
| if (entry.isIntersecting) { | |
| dispatch('visible'); | |
| // observer.unobserve(loaderElement); // Stop observing until content is loaded | |
| } | |
| }); | |
| }, | |
| { | |
| root: null, // viewport | |
| rootMargin: '0px', | |
| threshold: 0.1 // When 10% of the loader is visible | |
| } | |
| ); | |
| observer.observe(loaderElement); | |
| }); | |
| </script> | |
| <div bind:this={loaderElement}> | |
| <slot /> | |
| </div> | |