koel/resources/assets/js/composables/useOverlay.ts

14 lines
426 B
TypeScript
Raw Normal View History

import { Ref } from 'vue'
import { requireInjection } from '@/utils'
import { OverlayKey } from '@/symbols'
import Overlay from '@/components/ui/Overlay.vue'
2024-04-23 21:01:27 +00:00
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)
}
}