realar-project / realar

5 kB Advanced state manager for React
MIT License
44 stars 0 forks source link

proposal: pool.flat #91

Closed betula closed 3 years ago

betula commented 3 years ago
private finish_purchase = pool(async () => {
    if (this.finish_purchase.count > 1) return; // not count.val here
  });
betula commented 3 years ago
const a = pool(async () => {
    if (a.count.val > 1) return a.threads[0].promise; // Return promise from first thread
}

assert(a.flat.pending === false);
assert(chan(async () => {}).flat.pending === false);
betula commented 3 years ago

Added to "the stream of conciseness 0.7+ roadmap"