2021-11-14 21:57:36 +01:00
|
|
|
import { computed, watchEffect } from 'vue'
|
2022-04-11 22:08:28 +02:00
|
|
|
import type { ComputedGetter } from 'vue'
|
2021-11-14 21:57:36 +01:00
|
|
|
|
2022-04-11 22:08:28 +02:00
|
|
|
import { setTitle } from '@/helpers/setTitle'
|
2021-11-14 21:57:36 +01:00
|
|
|
|
2022-01-30 16:47:23 +01:00
|
|
|
export function useTitle(titleGetter: ComputedGetter<string>) {
|
2021-11-14 21:57:36 +01:00
|
|
|
const titleRef = computed(titleGetter)
|
|
|
|
|
|
|
|
watchEffect(() => setTitle(titleRef.value))
|
|
|
|
|
|
|
|
return titleRef
|
|
|
|
}
|