> For the complete documentation index, see [llms.txt](https://laterly.gitbook.io/hooks-vue3/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://laterly.gitbook.io/hooks-vue3/useraftimeout.md).

# useRafTimeout

#### 基础用法

```html

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

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

```

### API

```typescript

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

### 参数TS类型

```typescript

export type UseTimeoutFnReturn = {
  isRunning: Ref<boolean>; //是否已经触发了
  stop: () => void; //取消定时器
  start: () => void; //重新执行定时器
};
export type UseTimeoutFnOptions = {
  immediate?: boolean;
  autoStart?: boolean;
};

function useRafTimeout(
  callback: () => void,
  delay = 0,
  options?: UseTimeoutFnOptions,
): UseTimeoutFnReturn

```
