From aa09cfe26490ee567e70557ddd963c6a5b540739 Mon Sep 17 00:00:00 2001 From: Dmytro Doroshenko Date: Wed, 3 Apr 2024 02:45:06 +0300 Subject: [PATCH] fixed onDrain call when queue is drained --- JavaScript/6-promise.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JavaScript/6-promise.js b/JavaScript/6-promise.js index 07162c5..96e2780 100644 --- a/JavaScript/6-promise.js +++ b/JavaScript/6-promise.js @@ -34,7 +34,6 @@ class Queue { (err) => void this.finish(err) ) .finally(() => { - this.count--; if (this.waiting.length > 0) this.next(); }); } @@ -45,6 +44,7 @@ class Queue { if (err && onFailure) onFailure(err, res); else if (onSuccess) onSuccess(res); if (onDone) onDone(err, res); + this.count--; if (this.count === 0 && this.waiting.length === 0 && onDrain) onDrain(); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy