Blame view

天文台pc/tianwentai-ui/node_modules/motion-dom/dist/es/effects/utils/create-effect.mjs 690 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  import { MotionValueState } from '../MotionValueState.mjs';
  
  function createEffect(addValue) {
      const stateCache = new WeakMap();
      return (subject, values) => {
          const state = stateCache.get(subject) ?? new MotionValueState();
          stateCache.set(subject, state);
          const subscriptions = [];
          for (const key in values) {
              const value = values[key];
              const remove = addValue(subject, state, key, value);
              subscriptions.push(remove);
          }
          return () => {
              for (const cancel of subscriptions)
                  cancel();
          };
      };
  }
  
  export { createEffect };
  //# sourceMappingURL=create-effect.mjs.map