vikunja-frontend/src/composables/useTitle.ts

12 lines
303 B
TypeScript
Raw Normal View History

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