UNPKG

motion-v

Version:

<p align="center"> <img width="100" height="100" alt="Motion logo" src="https://user-images.githubusercontent.com/7850794/164965523-3eced4c4-6020-467e-acde-f11b7900ad62.png" /> </p> <h1 align="center">Motion for Vue</h1>

21 lines (20 loc) 699 B
import { useCombineMotionValues } from "./use-combine-values.mjs"; import { watchEffect } from "vue"; import { collectMotionValues } from "../external/.pnpm/motion-dom@12.23.12/external/motion-dom/dist/es/value/index.mjs"; function useComputed(computed) { collectMotionValues.current = []; const { value, subscribe, unsubscribe, updateValue } = useCombineMotionValues(computed); subscribe(collectMotionValues.current); collectMotionValues.current = void 0; watchEffect(() => { unsubscribe(); collectMotionValues.current = []; updateValue(); subscribe(collectMotionValues.current); collectMotionValues.current = void 0; }); return value; } export { useComputed };