summaryrefslogtreecommitdiff
path: root/std/node/events.ts
diff options
context:
space:
mode:
authorSchwarzkopf Balázs <schwarzkopfb@icloud.com>2020-08-27 11:00:38 +0200
committerGitHub <noreply@github.com>2020-08-27 11:00:38 +0200
commite1564f385c770ac37c550f7d9e164d6a846c191e (patch)
tree1fbf2e00012793b64f07c8085d6e4d006a139a3b /std/node/events.ts
parent7583fd0979ee35144c7df078d00aa2e78b510be9 (diff)
fix(std/node): "events" and "util" modules (#7170)
Diffstat (limited to 'std/node/events.ts')
-rw-r--r--std/node/events.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/std/node/events.ts b/std/node/events.ts
index bc27731ca..d7c2275a0 100644
--- a/std/node/events.ts
+++ b/std/node/events.ts
@@ -21,7 +21,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
-import { validateIntegerRange } from "./util.ts";
+import { validateIntegerRange } from "./_utils.ts";
import { assert } from "../_util/assert.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -356,7 +356,14 @@ export default class EventEmitter {
* Infinity (or 0) to indicate an unlimited number of listeners.
*/
public setMaxListeners(n: number): this {
- validateIntegerRange(n, "maxListeners", 0);
+ if (n !== Infinity) {
+ if (n === 0) {
+ n = Infinity;
+ } else {
+ validateIntegerRange(n, "maxListeners", 0);
+ }
+ }
+
this.maxListeners = n;
return this;
}