Skip to content

useRafFn ​

类别
导出大小
443 B
最近修改
7 months ago

对每个 requestAnimationFrame 调用函数。具有暂停和恢复的控制功能。

🌐 Call function on every requestAnimationFrame. With controls of pausing and resuming.

示例 ​

Frames: 0
Delta: 0ms
FPS Limit: 60

用法 ​

🌐 Usage

ts
import { 
useRafFn
} from '@vueuse/core'
import {
shallowRef
} from 'vue'
const
count
=
shallowRef
(0)
const {
pause
,
resume
} =
useRafFn
(() => {
count
.
value
++
console
.
log
(
count
.
value
)
})