watch: use internal addAbortListener

PR-URL: https://github.com/nodejs/node/pull/52081
Refs: https://github.com/nodejs/node/pull/48596
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
atlowChemi 2024-03-14 10:57:28 +02:00 committed by Node.js GitHub Bot
parent 780d030bdf
commit fec7e505fc
1 changed files with 2 additions and 1 deletions

View File

@ -13,6 +13,7 @@ const { kEmptyObject } = require('internal/util');
const { TIMEOUT_MAX } = require('internal/timers');
const EventEmitter = require('events');
const { addAbortListener } = require('internal/events/abort_listener');
const { watch } = require('fs');
const { fileURLToPath } = require('internal/url');
const { resolve, dirname } = require('path');
@ -41,7 +42,7 @@ class FilesWatcher extends EventEmitter {
this.#signal = signal;
if (signal) {
EventEmitter.addAbortListener(signal, () => this.clear());
addAbortListener(signal, () => this.clear());
}
}