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>

33 lines (32 loc) 707 B
function notify(node) { return !node.isLayoutDirty && node.willUpdate(false); } function nodeGroup() { const nodes = /* @__PURE__ */ new Set(); const subscriptions = /* @__PURE__ */ new WeakMap(); const dirtyAll = (node) => { nodes.forEach(notify); }; return { add: (node) => { nodes.add(node); subscriptions.set( node, node.addEventListener("willUpdate", () => dirtyAll()) ); }, remove: (node) => { nodes.delete(node); const unsubscribe = subscriptions.get(node); if (unsubscribe) { unsubscribe(); subscriptions.delete(node); } dirtyAll(); }, dirty: dirtyAll }; } export { nodeGroup };