Blame view

天文台pc/tianwentai-ui/node_modules/motion-dom/dist/es/value/subscribe-value.mjs 546 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  import { cancelFrame, frame } from '../frameloop/frame.mjs';
  
  function subscribeValue(inputValues, outputValue, getLatest) {
      const update = () => outputValue.set(getLatest());
      const scheduleUpdate = () => frame.preRender(update, false, true);
      const subscriptions = inputValues.map((v) => v.on("change", scheduleUpdate));
      outputValue.on("destroy", () => {
          subscriptions.forEach((unsubscribe) => unsubscribe());
          cancelFrame(update);
      });
  }
  
  export { subscribeValue };
  //# sourceMappingURL=subscribe-value.mjs.map