@yesstudio/nuxt-composables
    Preparing search index...

    Function useInterval

    • Manages the repeated execution of a callback.

      Parameters

      • callback: () => void

        The callback to invoke when the interval elapses.

      • interval: MaybeRefOrGetter<number>

        The number of milliseconds to wait before invoking the callback.

      • Optionaloptions: UseIntervalOptions

        Optional configuration options.

      Returns UseInterval

      An object with a readonly reference indicating whether the callback is currently scheduled for repeated execution, and methods to start and stop the callback.

      const counter = ref(0)

      useInterval(() => counter.value++, 1000, { immediate: true })