import { ref } from 'vue'
import { useTimestamp } from '@vueuse/core'

const useSpentTime = () => {
  const timeStart = ref<number>(Date.now())

  const timeEnd = useTimestamp()

  const resume = () => {
    timeStart.value = Date.now()
  }

  const getSpentTime = () => {
    return timeEnd.value - timeStart.value
  }

  return { getSpentTime, resume }
}

export default useSpentTime
