This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/composables/useTitle.ts
dpschen d0d4096f8b
All checks were successful
continuous-integration/drone/push Build is passing
feature/use-setup-api-for-user-and-about-pages (#929)
Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: #929
Reviewed-by: konrad <k@knt.li>
Co-authored-by: dpschen <dpschen@noreply.kolaente.de>
Co-committed-by: dpschen <dpschen@noreply.kolaente.de>
2021-11-14 20:57:36 +00:00

12 lines
338 B
TypeScript

import { computed, watchEffect } from 'vue'
import { setTitle } from '@/helpers/setTitle'
import { ComputedGetter, ComputedRef } from '@vue/reactivity'
export function useTitle<T>(titleGetter: ComputedGetter<T>) : ComputedRef<T> {
const titleRef = computed(titleGetter)
watchEffect(() => setTitle(titleRef.value))
return titleRef
}