# useRafInterval

#### 基础用法

```html

<template>
  <div>Hello World! {{ count }}</div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { useRafInterval } from "hooks-vue3";
const count = ref<number>(0);
useRafInterval(() => {
  count.value++;
}, 3000);
</script>


```

### API

```typescript

useRafInterval(() => void, time:number);
```

### 参数TS类型

```typescript
export type UseIntervalFnReturn = {
  isRunning: Ref<boolean>;
  start: () => void; //开始定时器
  stop: () => void; //停止定时器
};

export type UseIntervalFnOptions = {
  immediate?: boolean;
  autoStart?: boolean;
};

function useRafInterval(
  callback: () => void,
  delay = 0,
  options?: UseIntervalFnOptions,
): UseIntervalFnReturn
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://laterly.gitbook.io/hooks-vue3/userafinterval.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
