mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-11 18:19:58 +00:00
Rename directory: ext -> extension
This commit is contained in:
31
extension/src/ui/LoadingIndicator.svelte
Normal file
31
extension/src/ui/LoadingIndicator.svelte
Normal file
@@ -0,0 +1,31 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
|
||||
function getNextEllipsis(ellipsis: string): string {
|
||||
if (ellipsis === "") return ".";
|
||||
if (ellipsis === ".") return "..";
|
||||
if (ellipsis === "..") return "...";
|
||||
if (ellipsis === "...") return "";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
export let interval = 500;
|
||||
|
||||
let ellipsis = "";
|
||||
let intervalId: number;
|
||||
|
||||
onMount(() => {
|
||||
intervalId = window.setInterval(() => {
|
||||
ellipsis = getNextEllipsis(ellipsis);
|
||||
}, interval);
|
||||
|
||||
return () => {
|
||||
window.clearInterval(intervalId);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<span class="indicator">
|
||||
<slot />{ellipsis}
|
||||
</span>
|
||||
Reference in New Issue
Block a user