summitjs 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/summit.js CHANGED
@@ -50,6 +50,7 @@ function track(dep) {
50
50
  }
51
51
  }
52
52
  function trigger(dep) {
53
+ if (dep.size === 0) return;
53
54
  const effects = [...dep];
54
55
  for (const eff of effects) {
55
56
  if (eff === activeEffect) continue;
@@ -83,8 +84,8 @@ function batch(fn) {
83
84
  }
84
85
  function flushBatch() {
85
86
  if (pendingEffects.size === 0) return;
86
- const effects = [...pendingEffects];
87
- pendingEffects.clear();
87
+ const effects = pendingEffects;
88
+ pendingEffects = /* @__PURE__ */ new Set();
88
89
  for (const eff of effects) {
89
90
  if (eff.active) runEffect(eff);
90
91
  }
@@ -246,8 +247,8 @@ function queueJob(job) {
246
247
  }
247
248
  }
248
249
  function flushJobs() {
249
- const jobs = [...queue];
250
- queue.clear();
250
+ const jobs = queue;
251
+ queue = /* @__PURE__ */ new Set();
251
252
  flushing = false;
252
253
  flushPromise = null;
253
254
  for (const job of jobs) job();