koel/resources/assets/js/composables/useOverlay.ts
2024-10-14 00:37:01 +07:00

13 lines
437 B
TypeScript

import type { Ref } from 'vue'
import { requireInjection } from '@/utils'
import { OverlayKey } from '@/symbols'
import type Overlay from '@/components/ui/Overlay.vue'
export const useOverlay = (overlay?: Ref<InstanceType<typeof Overlay>> | null) => {
overlay = overlay || requireInjection(OverlayKey)
return {
showOverlay: overlay.value.show.bind(overlay.value),
hideOverlay: overlay.value.hide.bind(overlay.value),
}
}