mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
20 lines
473 B
TypeScript
20 lines
473 B
TypeScript
// Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
|
|
|
|
import { refDebounced } from '@vueuse/shared'
|
|
import { type Ref, type ComputedRef, ref } from 'vue'
|
|
|
|
export const useDebouncedLoading = ({
|
|
ms,
|
|
isLoading,
|
|
}: {
|
|
ms?: number
|
|
isLoading?: Ref<boolean> | ComputedRef<boolean>
|
|
} = {}) => {
|
|
const loading = ref(false)
|
|
const debouncedLoading = refDebounced(isLoading ?? loading, ms ?? 300)
|
|
|
|
return {
|
|
loading,
|
|
debouncedLoading,
|
|
}
|
|
}
|