UNPKG

framer-motion

Version:

A simple and powerful JavaScript animation library

1 lines 837 B
{"version":3,"file":"use-computed.mjs","sources":["../../../src/value/use-computed.ts"],"sourcesContent":["\"use client\"\n\nimport { collectMotionValues, type MotionValue } from \"motion-dom\"\nimport { useCombineMotionValues } from \"./use-combine-values\"\n\nexport function useComputed<O>(compute: () => O): MotionValue<O> {\n /**\n * Open session of collectMotionValues. Any MotionValue that calls get()\n * will be saved into this array.\n */\n collectMotionValues.current = []\n\n compute()\n\n const value = useCombineMotionValues(collectMotionValues.current, compute)\n\n /**\n * Synchronously close session of collectMotionValues.\n */\n collectMotionValues.current = undefined\n\n return value\n}\n"],"names":[],"mappings":";;;;AAKM;AACF;;;AAGG;AACH;AAEA;;AAIA;;AAEG;AACH;AAEA;AACJ;;"}