useRafFn
Call function on every requestAnimationFrame
. With controls of pausing and resuming.
Demo
Frames: 0
Delta: 0ms
FPS Limit: 60
Usage
js
import { ref } from 'vue';
import { useRafFn } from '@hungpvq/shared-core';
const count = ref(0);
const { pause, resume } = useRafFn(() => {
count.value++;
console.log(count.value);
});