useRafFn
useRafFn
requestAnimationFrame のたびに関数を呼び出します。停止と再開の制御が可能です。
使用法
import { useRafFn } from '@vueuse/core'
import { shallowRef } from 'vue'
const count = shallowRef(0)
const { pause, resume } = useRafFn(() => {
count.value++
console.log(count.value)
})
© 2019–PRESENT Anthony Fu https://github.com/antfu
※このページは Nuxt.js 公式ドキュメントの翻訳ページです。
公式ドキュメントの該当ページはこちら:
#