rahad-all-downloader 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.cache/nix/binary-cache-v6.sqlite +0 -0
- package/.cache/nix/binary-cache-v6.sqlite-journal +0 -0
- package/.cache/replit/__replit_disk_meta.json +1 -0
- package/.cache/replit/modules/nodejs-20.res +1 -0
- package/.cache/replit/modules/replit.res +1 -0
- package/.cache/replit/modules.stamp +0 -0
- package/.cache/replit/nix/env.json +1 -0
- package/.cache/typescript/5.0/node_modules/.package-lock.json +12 -0
- package/.cache/typescript/5.0/node_modules/types-registry/README.md +2 -0
- package/.cache/typescript/5.0/node_modules/types-registry/index.json +1 -0
- package/.cache/typescript/5.0/node_modules/types-registry/package.json +20 -0
- package/.cache/typescript/5.0/package-lock.json +17 -0
- package/.cache/typescript/5.0/package.json +1 -0
- package/.cache/typescript/5.3/node_modules/.package-lock.json +99 -0
- package/.cache/typescript/5.3/node_modules/@types/node/LICENSE +21 -0
- package/.cache/typescript/5.3/node_modules/@types/node/README.md +15 -0
- package/.cache/typescript/5.3/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/.cache/typescript/5.3/node_modules/@types/node/assert.d.ts +996 -0
- package/.cache/typescript/5.3/node_modules/@types/node/async_hooks.d.ts +539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/buffer.d.ts +2362 -0
- package/.cache/typescript/5.3/node_modules/@types/node/child_process.d.ts +1540 -0
- package/.cache/typescript/5.3/node_modules/@types/node/cluster.d.ts +432 -0
- package/.cache/typescript/5.3/node_modules/@types/node/console.d.ts +415 -0
- package/.cache/typescript/5.3/node_modules/@types/node/constants.d.ts +19 -0
- package/.cache/typescript/5.3/node_modules/@types/node/crypto.d.ts +4456 -0
- package/.cache/typescript/5.3/node_modules/@types/node/dgram.d.ts +586 -0
- package/.cache/typescript/5.3/node_modules/@types/node/diagnostics_channel.d.ts +191 -0
- package/.cache/typescript/5.3/node_modules/@types/node/dns/promises.d.ts +425 -0
- package/.cache/typescript/5.3/node_modules/@types/node/dns.d.ts +809 -0
- package/.cache/typescript/5.3/node_modules/@types/node/dom-events.d.ts +122 -0
- package/.cache/typescript/5.3/node_modules/@types/node/domain.d.ts +170 -0
- package/.cache/typescript/5.3/node_modules/@types/node/events.d.ts +879 -0
- package/.cache/typescript/5.3/node_modules/@types/node/fs/promises.d.ts +1239 -0
- package/.cache/typescript/5.3/node_modules/@types/node/fs.d.ts +4291 -0
- package/.cache/typescript/5.3/node_modules/@types/node/globals.d.ts +385 -0
- package/.cache/typescript/5.3/node_modules/@types/node/globals.global.d.ts +1 -0
- package/.cache/typescript/5.3/node_modules/@types/node/http.d.ts +1888 -0
- package/.cache/typescript/5.3/node_modules/@types/node/http2.d.ts +2382 -0
- package/.cache/typescript/5.3/node_modules/@types/node/https.d.ts +550 -0
- package/.cache/typescript/5.3/node_modules/@types/node/index.d.ts +88 -0
- package/.cache/typescript/5.3/node_modules/@types/node/inspector.d.ts +2747 -0
- package/.cache/typescript/5.3/node_modules/@types/node/module.d.ts +301 -0
- package/.cache/typescript/5.3/node_modules/@types/node/net.d.ts +949 -0
- package/.cache/typescript/5.3/node_modules/@types/node/os.d.ts +478 -0
- package/.cache/typescript/5.3/node_modules/@types/node/package.json +230 -0
- package/.cache/typescript/5.3/node_modules/@types/node/path.d.ts +191 -0
- package/.cache/typescript/5.3/node_modules/@types/node/perf_hooks.d.ts +639 -0
- package/.cache/typescript/5.3/node_modules/@types/node/process.d.ts +1539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/punycode.d.ts +117 -0
- package/.cache/typescript/5.3/node_modules/@types/node/querystring.d.ts +141 -0
- package/.cache/typescript/5.3/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/.cache/typescript/5.3/node_modules/@types/node/readline.d.ts +539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/repl.d.ts +430 -0
- package/.cache/typescript/5.3/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/.cache/typescript/5.3/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/.cache/typescript/5.3/node_modules/@types/node/stream/web.d.ts +350 -0
- package/.cache/typescript/5.3/node_modules/@types/node/stream.d.ts +1701 -0
- package/.cache/typescript/5.3/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/.cache/typescript/5.3/node_modules/@types/node/test.d.ts +1382 -0
- package/.cache/typescript/5.3/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/.cache/typescript/5.3/node_modules/@types/node/timers.d.ts +240 -0
- package/.cache/typescript/5.3/node_modules/@types/node/tls.d.ts +1210 -0
- package/.cache/typescript/5.3/node_modules/@types/node/trace_events.d.ts +182 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/assert.d.ts +996 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/async_hooks.d.ts +539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/buffer.d.ts +2362 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/child_process.d.ts +1540 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/console.d.ts +415 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/crypto.d.ts +4455 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dgram.d.ts +586 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dns/promises.d.ts +425 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/events.d.ts +879 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/fs/promises.d.ts +1239 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/fs.d.ts +4291 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/globals.d.ts +385 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/http.d.ts +1888 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/http2.d.ts +2382 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/https.d.ts +550 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/inspector.d.ts +2747 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/module.d.ts +301 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/net.d.ts +949 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/os.d.ts +478 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/perf_hooks.d.ts +639 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/process.d.ts +1539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/readline/promises.d.ts +150 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/readline.d.ts +539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/web.d.ts +350 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream.d.ts +1701 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/test.d.ts +1382 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/timers.d.ts +240 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/tls.d.ts +1210 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/url.d.ts +927 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/util.d.ts +2183 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/vm.d.ts +903 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/worker_threads.d.ts +691 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/.cache/typescript/5.3/node_modules/@types/node/tty.d.ts +208 -0
- package/.cache/typescript/5.3/node_modules/@types/node/url.d.ts +927 -0
- package/.cache/typescript/5.3/node_modules/@types/node/util.d.ts +2183 -0
- package/.cache/typescript/5.3/node_modules/@types/node/v8.d.ts +635 -0
- package/.cache/typescript/5.3/node_modules/@types/node/vm.d.ts +903 -0
- package/.cache/typescript/5.3/node_modules/@types/node/wasi.d.ts +158 -0
- package/.cache/typescript/5.3/node_modules/@types/node/worker_threads.d.ts +691 -0
- package/.cache/typescript/5.3/node_modules/@types/node/zlib.d.ts +517 -0
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/LICENSE +21 -0
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/README.md +15 -0
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/externals.d.ts +32 -0
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/index.d.ts +214 -0
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/package.json +83 -0
- package/.cache/typescript/5.3/node_modules/asynckit/LICENSE +21 -0
- package/.cache/typescript/5.3/node_modules/asynckit/README.md +233 -0
- package/.cache/typescript/5.3/node_modules/asynckit/bench.js +76 -0
- package/.cache/typescript/5.3/node_modules/asynckit/index.js +6 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/abort.js +29 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/async.js +34 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/defer.js +26 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/iterate.js +75 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/state.js +37 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/streamify.js +141 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/terminator.js +29 -0
- package/.cache/typescript/5.3/node_modules/asynckit/package.json +63 -0
- package/.cache/typescript/5.3/node_modules/asynckit/parallel.js +43 -0
- package/.cache/typescript/5.3/node_modules/asynckit/serial.js +17 -0
- package/.cache/typescript/5.3/node_modules/asynckit/serialOrdered.js +75 -0
- package/.cache/typescript/5.3/node_modules/asynckit/stream.js +21 -0
- package/.cache/typescript/5.3/node_modules/combined-stream/License +19 -0
- package/.cache/typescript/5.3/node_modules/combined-stream/Readme.md +138 -0
- package/.cache/typescript/5.3/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/.cache/typescript/5.3/node_modules/combined-stream/package.json +25 -0
- package/.cache/typescript/5.3/node_modules/combined-stream/yarn.lock +17 -0
- package/.cache/typescript/5.3/node_modules/delayed-stream/License +19 -0
- package/.cache/typescript/5.3/node_modules/delayed-stream/Makefile +7 -0
- package/.cache/typescript/5.3/node_modules/delayed-stream/Readme.md +141 -0
- package/.cache/typescript/5.3/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/.cache/typescript/5.3/node_modules/delayed-stream/package.json +27 -0
- package/.cache/typescript/5.3/node_modules/form-data/License +19 -0
- package/.cache/typescript/5.3/node_modules/form-data/README.md.bak +358 -0
- package/.cache/typescript/5.3/node_modules/form-data/Readme.md +358 -0
- package/.cache/typescript/5.3/node_modules/form-data/index.d.ts +62 -0
- package/.cache/typescript/5.3/node_modules/form-data/lib/browser.js +2 -0
- package/.cache/typescript/5.3/node_modules/form-data/lib/form_data.js +501 -0
- package/.cache/typescript/5.3/node_modules/form-data/lib/populate.js +10 -0
- package/.cache/typescript/5.3/node_modules/form-data/package.json +68 -0
- package/.cache/typescript/5.3/node_modules/mime-db/HISTORY.md +507 -0
- package/.cache/typescript/5.3/node_modules/mime-db/LICENSE +23 -0
- package/.cache/typescript/5.3/node_modules/mime-db/README.md +100 -0
- package/.cache/typescript/5.3/node_modules/mime-db/db.json +8519 -0
- package/.cache/typescript/5.3/node_modules/mime-db/index.js +12 -0
- package/.cache/typescript/5.3/node_modules/mime-db/package.json +60 -0
- package/.cache/typescript/5.3/node_modules/mime-types/HISTORY.md +397 -0
- package/.cache/typescript/5.3/node_modules/mime-types/LICENSE +23 -0
- package/.cache/typescript/5.3/node_modules/mime-types/README.md +113 -0
- package/.cache/typescript/5.3/node_modules/mime-types/index.js +188 -0
- package/.cache/typescript/5.3/node_modules/mime-types/package.json +44 -0
- package/.cache/typescript/5.3/node_modules/types-registry/README.md +2 -0
- package/.cache/typescript/5.3/node_modules/types-registry/index.json +1 -0
- package/.cache/typescript/5.3/node_modules/types-registry/package.json +20 -0
- package/.cache/typescript/5.3/node_modules/undici-types/README.md +6 -0
- package/.cache/typescript/5.3/node_modules/undici-types/agent.d.ts +31 -0
- package/.cache/typescript/5.3/node_modules/undici-types/api.d.ts +43 -0
- package/.cache/typescript/5.3/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/.cache/typescript/5.3/node_modules/undici-types/cache.d.ts +36 -0
- package/.cache/typescript/5.3/node_modules/undici-types/client.d.ts +97 -0
- package/.cache/typescript/5.3/node_modules/undici-types/connector.d.ts +34 -0
- package/.cache/typescript/5.3/node_modules/undici-types/content-type.d.ts +21 -0
- package/.cache/typescript/5.3/node_modules/undici-types/cookies.d.ts +28 -0
- package/.cache/typescript/5.3/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/.cache/typescript/5.3/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/.cache/typescript/5.3/node_modules/undici-types/errors.d.ts +128 -0
- package/.cache/typescript/5.3/node_modules/undici-types/fetch.d.ts +209 -0
- package/.cache/typescript/5.3/node_modules/undici-types/file.d.ts +39 -0
- package/.cache/typescript/5.3/node_modules/undici-types/filereader.d.ts +54 -0
- package/.cache/typescript/5.3/node_modules/undici-types/formdata.d.ts +108 -0
- package/.cache/typescript/5.3/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/.cache/typescript/5.3/node_modules/undici-types/global-origin.d.ts +7 -0
- package/.cache/typescript/5.3/node_modules/undici-types/handlers.d.ts +9 -0
- package/.cache/typescript/5.3/node_modules/undici-types/header.d.ts +4 -0
- package/.cache/typescript/5.3/node_modules/undici-types/index.d.ts +63 -0
- package/.cache/typescript/5.3/node_modules/undici-types/interceptors.d.ts +5 -0
- package/.cache/typescript/5.3/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/.cache/typescript/5.3/node_modules/undici-types/mock-client.d.ts +25 -0
- package/.cache/typescript/5.3/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/.cache/typescript/5.3/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/.cache/typescript/5.3/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/.cache/typescript/5.3/node_modules/undici-types/package.json +55 -0
- package/.cache/typescript/5.3/node_modules/undici-types/patch.d.ts +71 -0
- package/.cache/typescript/5.3/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/.cache/typescript/5.3/node_modules/undici-types/pool.d.ts +28 -0
- package/.cache/typescript/5.3/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/.cache/typescript/5.3/node_modules/undici-types/readable.d.ts +61 -0
- package/.cache/typescript/5.3/node_modules/undici-types/webidl.d.ts +220 -0
- package/.cache/typescript/5.3/node_modules/undici-types/websocket.d.ts +131 -0
- package/.cache/typescript/5.3/package-lock.json +107 -0
- package/.cache/typescript/5.3/package.json +1 -0
- package/.cache/typescript/5.4/node_modules/.package-lock.json +115 -0
- package/.cache/typescript/5.4/node_modules/@types/body-parser/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/body-parser/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/body-parser/index.d.ts +95 -0
- package/.cache/typescript/5.4/node_modules/@types/body-parser/package.json +58 -0
- package/.cache/typescript/5.4/node_modules/@types/connect/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/connect/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/connect/index.d.ts +91 -0
- package/.cache/typescript/5.4/node_modules/@types/connect/package.json +32 -0
- package/.cache/typescript/5.4/node_modules/@types/express/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/express/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/express/index.d.ts +128 -0
- package/.cache/typescript/5.4/node_modules/@types/express/package.json +45 -0
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/index.d.ts +1295 -0
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/package.json +50 -0
- package/.cache/typescript/5.4/node_modules/@types/http-errors/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/http-errors/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/http-errors/index.d.ts +77 -0
- package/.cache/typescript/5.4/node_modules/@types/http-errors/package.json +30 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/Mime.d.ts +10 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/index.d.ts +31 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/lite.d.ts +7 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/package.json +30 -0
- package/.cache/typescript/5.4/node_modules/@types/node/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/node/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/.cache/typescript/5.4/node_modules/@types/node/assert.d.ts +1040 -0
- package/.cache/typescript/5.4/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/.cache/typescript/5.4/node_modules/@types/node/buffer.d.ts +2363 -0
- package/.cache/typescript/5.4/node_modules/@types/node/child_process.d.ts +1544 -0
- package/.cache/typescript/5.4/node_modules/@types/node/cluster.d.ts +578 -0
- package/.cache/typescript/5.4/node_modules/@types/node/console.d.ts +452 -0
- package/.cache/typescript/5.4/node_modules/@types/node/constants.d.ts +19 -0
- package/.cache/typescript/5.4/node_modules/@types/node/crypto.d.ts +4523 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dgram.d.ts +596 -0
- package/.cache/typescript/5.4/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dns/promises.d.ts +474 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dns.d.ts +864 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dom-events.d.ts +124 -0
- package/.cache/typescript/5.4/node_modules/@types/node/domain.d.ts +170 -0
- package/.cache/typescript/5.4/node_modules/@types/node/events.d.ts +909 -0
- package/.cache/typescript/5.4/node_modules/@types/node/fs/promises.d.ts +1245 -0
- package/.cache/typescript/5.4/node_modules/@types/node/fs.d.ts +4317 -0
- package/.cache/typescript/5.4/node_modules/@types/node/globals.d.ts +411 -0
- package/.cache/typescript/5.4/node_modules/@types/node/globals.global.d.ts +1 -0
- package/.cache/typescript/5.4/node_modules/@types/node/http.d.ts +1908 -0
- package/.cache/typescript/5.4/node_modules/@types/node/http2.d.ts +2418 -0
- package/.cache/typescript/5.4/node_modules/@types/node/https.d.ts +550 -0
- package/.cache/typescript/5.4/node_modules/@types/node/index.d.ts +89 -0
- package/.cache/typescript/5.4/node_modules/@types/node/inspector.d.ts +2746 -0
- package/.cache/typescript/5.4/node_modules/@types/node/module.d.ts +315 -0
- package/.cache/typescript/5.4/node_modules/@types/node/net.d.ts +999 -0
- package/.cache/typescript/5.4/node_modules/@types/node/os.d.ts +495 -0
- package/.cache/typescript/5.4/node_modules/@types/node/package.json +217 -0
- package/.cache/typescript/5.4/node_modules/@types/node/path.d.ts +191 -0
- package/.cache/typescript/5.4/node_modules/@types/node/perf_hooks.d.ts +905 -0
- package/.cache/typescript/5.4/node_modules/@types/node/process.d.ts +1754 -0
- package/.cache/typescript/5.4/node_modules/@types/node/punycode.d.ts +117 -0
- package/.cache/typescript/5.4/node_modules/@types/node/querystring.d.ts +153 -0
- package/.cache/typescript/5.4/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/.cache/typescript/5.4/node_modules/@types/node/readline.d.ts +540 -0
- package/.cache/typescript/5.4/node_modules/@types/node/repl.d.ts +430 -0
- package/.cache/typescript/5.4/node_modules/@types/node/sea.d.ts +153 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/web.d.ts +367 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream.d.ts +1707 -0
- package/.cache/typescript/5.4/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/.cache/typescript/5.4/node_modules/@types/node/test.d.ts +1718 -0
- package/.cache/typescript/5.4/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/.cache/typescript/5.4/node_modules/@types/node/timers.d.ts +240 -0
- package/.cache/typescript/5.4/node_modules/@types/node/tls.d.ts +1217 -0
- package/.cache/typescript/5.4/node_modules/@types/node/trace_events.d.ts +197 -0
- package/.cache/typescript/5.4/node_modules/@types/node/tty.d.ts +208 -0
- package/.cache/typescript/5.4/node_modules/@types/node/url.d.ts +952 -0
- package/.cache/typescript/5.4/node_modules/@types/node/util.d.ts +2292 -0
- package/.cache/typescript/5.4/node_modules/@types/node/v8.d.ts +808 -0
- package/.cache/typescript/5.4/node_modules/@types/node/vm.d.ts +924 -0
- package/.cache/typescript/5.4/node_modules/@types/node/wasi.d.ts +181 -0
- package/.cache/typescript/5.4/node_modules/@types/node/worker_threads.d.ts +691 -0
- package/.cache/typescript/5.4/node_modules/@types/node/zlib.d.ts +530 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/index.d.ts +79 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/package.json +65 -0
- package/.cache/typescript/5.4/node_modules/@types/range-parser/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/range-parser/README.md +53 -0
- package/.cache/typescript/5.4/node_modules/@types/range-parser/index.d.ts +34 -0
- package/.cache/typescript/5.4/node_modules/@types/range-parser/package.json +25 -0
- package/.cache/typescript/5.4/node_modules/@types/send/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/send/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/send/index.d.ts +225 -0
- package/.cache/typescript/5.4/node_modules/@types/send/package.json +33 -0
- package/.cache/typescript/5.4/node_modules/@types/serve-static/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/serve-static/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/serve-static/index.d.ts +107 -0
- package/.cache/typescript/5.4/node_modules/@types/serve-static/package.json +39 -0
- package/.cache/typescript/5.4/node_modules/types-registry/README.md +2 -0
- package/.cache/typescript/5.4/node_modules/types-registry/index.json +1 -0
- package/.cache/typescript/5.4/node_modules/types-registry/package.json +20 -0
- package/.cache/typescript/5.4/node_modules/undici-types/README.md +6 -0
- package/.cache/typescript/5.4/node_modules/undici-types/agent.d.ts +31 -0
- package/.cache/typescript/5.4/node_modules/undici-types/api.d.ts +43 -0
- package/.cache/typescript/5.4/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/.cache/typescript/5.4/node_modules/undici-types/cache.d.ts +36 -0
- package/.cache/typescript/5.4/node_modules/undici-types/client.d.ts +97 -0
- package/.cache/typescript/5.4/node_modules/undici-types/connector.d.ts +34 -0
- package/.cache/typescript/5.4/node_modules/undici-types/content-type.d.ts +21 -0
- package/.cache/typescript/5.4/node_modules/undici-types/cookies.d.ts +28 -0
- package/.cache/typescript/5.4/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/.cache/typescript/5.4/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/.cache/typescript/5.4/node_modules/undici-types/errors.d.ts +128 -0
- package/.cache/typescript/5.4/node_modules/undici-types/fetch.d.ts +209 -0
- package/.cache/typescript/5.4/node_modules/undici-types/file.d.ts +39 -0
- package/.cache/typescript/5.4/node_modules/undici-types/filereader.d.ts +54 -0
- package/.cache/typescript/5.4/node_modules/undici-types/formdata.d.ts +108 -0
- package/.cache/typescript/5.4/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/.cache/typescript/5.4/node_modules/undici-types/global-origin.d.ts +7 -0
- package/.cache/typescript/5.4/node_modules/undici-types/handlers.d.ts +9 -0
- package/.cache/typescript/5.4/node_modules/undici-types/header.d.ts +4 -0
- package/.cache/typescript/5.4/node_modules/undici-types/index.d.ts +63 -0
- package/.cache/typescript/5.4/node_modules/undici-types/interceptors.d.ts +5 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-client.d.ts +25 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/.cache/typescript/5.4/node_modules/undici-types/package.json +55 -0
- package/.cache/typescript/5.4/node_modules/undici-types/patch.d.ts +71 -0
- package/.cache/typescript/5.4/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/.cache/typescript/5.4/node_modules/undici-types/pool.d.ts +28 -0
- package/.cache/typescript/5.4/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/.cache/typescript/5.4/node_modules/undici-types/readable.d.ts +61 -0
- package/.cache/typescript/5.4/node_modules/undici-types/webidl.d.ts +220 -0
- package/.cache/typescript/5.4/node_modules/undici-types/websocket.d.ts +131 -0
- package/.cache/typescript/5.4/package-lock.json +124 -0
- package/.cache/typescript/5.4/package.json +1 -0
- package/.replit +21 -0
- package/.upm/store.json +1 -0
- package/README.md +71 -0
- package/index.js +1 -0
- package/package.json +40 -0
- package/replit.nix +3 -0
@@ -0,0 +1,909 @@
|
|
1
|
+
/**
|
2
|
+
* Much of the Node.js core API is built around an idiomatic asynchronous
|
3
|
+
* event-driven architecture in which certain kinds of objects (called "emitters")
|
4
|
+
* emit named events that cause `Function` objects ("listeners") to be called.
|
5
|
+
*
|
6
|
+
* For instance: a `net.Server` object emits an event each time a peer
|
7
|
+
* connects to it; a `fs.ReadStream` emits an event when the file is opened;
|
8
|
+
* a `stream` emits an event whenever data is available to be read.
|
9
|
+
*
|
10
|
+
* All objects that emit events are instances of the `EventEmitter` class. These
|
11
|
+
* objects expose an `eventEmitter.on()` function that allows one or more
|
12
|
+
* functions to be attached to named events emitted by the object. Typically,
|
13
|
+
* event names are camel-cased strings but any valid JavaScript property key
|
14
|
+
* can be used.
|
15
|
+
*
|
16
|
+
* When the `EventEmitter` object emits an event, all of the functions attached
|
17
|
+
* to that specific event are called _synchronously_. Any values returned by the
|
18
|
+
* called listeners are _ignored_ and discarded.
|
19
|
+
*
|
20
|
+
* The following example shows a simple `EventEmitter` instance with a single
|
21
|
+
* listener. The `eventEmitter.on()` method is used to register listeners, while
|
22
|
+
* the `eventEmitter.emit()` method is used to trigger the event.
|
23
|
+
*
|
24
|
+
* ```js
|
25
|
+
* import { EventEmitter } from 'node:events';
|
26
|
+
*
|
27
|
+
* class MyEmitter extends EventEmitter {}
|
28
|
+
*
|
29
|
+
* const myEmitter = new MyEmitter();
|
30
|
+
* myEmitter.on('event', () => {
|
31
|
+
* console.log('an event occurred!');
|
32
|
+
* });
|
33
|
+
* myEmitter.emit('event');
|
34
|
+
* ```
|
35
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/events.js)
|
36
|
+
*/
|
37
|
+
declare module "events" {
|
38
|
+
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
|
39
|
+
// NOTE: This class is in the docs but is **not actually exported** by Node.
|
40
|
+
// If https://github.com/nodejs/node/issues/39903 gets resolved and Node
|
41
|
+
// actually starts exporting the class, uncomment below.
|
42
|
+
// import { EventListener, EventListenerObject } from '__dom-events';
|
43
|
+
// /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */
|
44
|
+
// interface NodeEventTarget extends EventTarget {
|
45
|
+
// /**
|
46
|
+
// * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API.
|
47
|
+
// * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget.
|
48
|
+
// */
|
49
|
+
// addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
|
50
|
+
// /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */
|
51
|
+
// eventNames(): string[];
|
52
|
+
// /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */
|
53
|
+
// listenerCount(type: string): number;
|
54
|
+
// /** Node.js-specific alias for `eventTarget.removeListener()`. */
|
55
|
+
// off(type: string, listener: EventListener | EventListenerObject): this;
|
56
|
+
// /** Node.js-specific alias for `eventTarget.addListener()`. */
|
57
|
+
// on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
|
58
|
+
// /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */
|
59
|
+
// once(type: string, listener: EventListener | EventListenerObject): this;
|
60
|
+
// /**
|
61
|
+
// * Node.js-specific extension to the `EventTarget` class.
|
62
|
+
// * If `type` is specified, removes all registered listeners for `type`,
|
63
|
+
// * otherwise removes all registered listeners.
|
64
|
+
// */
|
65
|
+
// removeAllListeners(type: string): this;
|
66
|
+
// /**
|
67
|
+
// * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`.
|
68
|
+
// * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`.
|
69
|
+
// */
|
70
|
+
// removeListener(type: string, listener: EventListener | EventListenerObject): this;
|
71
|
+
// }
|
72
|
+
interface EventEmitterOptions {
|
73
|
+
/**
|
74
|
+
* Enables automatic capturing of promise rejection.
|
75
|
+
*/
|
76
|
+
captureRejections?: boolean | undefined;
|
77
|
+
}
|
78
|
+
interface StaticEventEmitterOptions {
|
79
|
+
/**
|
80
|
+
* Can be used to cancel awaiting events.
|
81
|
+
*/
|
82
|
+
signal?: AbortSignal | undefined;
|
83
|
+
/**
|
84
|
+
* Names of events that will end the iteration.
|
85
|
+
*/
|
86
|
+
close?: string[] | undefined;
|
87
|
+
/**
|
88
|
+
* The high watermark. The emitter is paused every time the size
|
89
|
+
* of events being buffered is higher than it. Supported only
|
90
|
+
* on emitters implementing `pause()` and `resume()` methods.
|
91
|
+
* @default `Number.MAX_SAFE_INTEGER`
|
92
|
+
*/
|
93
|
+
highWaterMark?: number | undefined;
|
94
|
+
/**
|
95
|
+
* The low watermark. The emitter is resumed every time the size of events being buffered
|
96
|
+
* is lower than it. Supported only on emitters implementing `pause()` and `resume()` methods.
|
97
|
+
* @default 1
|
98
|
+
*/
|
99
|
+
lowWaterMark?: number | undefined;
|
100
|
+
}
|
101
|
+
interface EventEmitter<T extends EventMap<T> = DefaultEventMap> extends NodeJS.EventEmitter<T> {}
|
102
|
+
type EventMap<T> = Record<keyof T, any[]> | DefaultEventMap;
|
103
|
+
type DefaultEventMap = [never];
|
104
|
+
type AnyRest = [...args: any[]];
|
105
|
+
type Args<K, T> = T extends DefaultEventMap ? AnyRest : (
|
106
|
+
K extends keyof T ? T[K] : never
|
107
|
+
);
|
108
|
+
type Key<K, T> = T extends DefaultEventMap ? string | symbol : K | keyof T;
|
109
|
+
type Key2<K, T> = T extends DefaultEventMap ? string | symbol : K & keyof T;
|
110
|
+
type Listener<K, T, F> = T extends DefaultEventMap ? F : (
|
111
|
+
K extends keyof T ? (
|
112
|
+
T[K] extends unknown[] ? (...args: T[K]) => void : never
|
113
|
+
)
|
114
|
+
: never
|
115
|
+
);
|
116
|
+
type Listener1<K, T> = Listener<K, T, (...args: any[]) => void>;
|
117
|
+
type Listener2<K, T> = Listener<K, T, Function>;
|
118
|
+
|
119
|
+
/**
|
120
|
+
* The `EventEmitter` class is defined and exposed by the `node:events` module:
|
121
|
+
*
|
122
|
+
* ```js
|
123
|
+
* import { EventEmitter } from 'node:events';
|
124
|
+
* ```
|
125
|
+
*
|
126
|
+
* All `EventEmitter`s emit the event `'newListener'` when new listeners are
|
127
|
+
* added and `'removeListener'` when existing listeners are removed.
|
128
|
+
*
|
129
|
+
* It supports the following option:
|
130
|
+
* @since v0.1.26
|
131
|
+
*/
|
132
|
+
class EventEmitter<T extends EventMap<T> = DefaultEventMap> {
|
133
|
+
constructor(options?: EventEmitterOptions);
|
134
|
+
|
135
|
+
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: Key<K, T>, ...args: Args<K, T>): void;
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
|
139
|
+
* event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
|
140
|
+
* The `Promise` will resolve with an array of all the arguments emitted to the
|
141
|
+
* given event.
|
142
|
+
*
|
143
|
+
* This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event
|
144
|
+
* semantics and does not listen to the `'error'` event.
|
145
|
+
*
|
146
|
+
* ```js
|
147
|
+
* import { once, EventEmitter } from 'node:events';
|
148
|
+
* import process from 'node:process';
|
149
|
+
*
|
150
|
+
* const ee = new EventEmitter();
|
151
|
+
*
|
152
|
+
* process.nextTick(() => {
|
153
|
+
* ee.emit('myevent', 42);
|
154
|
+
* });
|
155
|
+
*
|
156
|
+
* const [value] = await once(ee, 'myevent');
|
157
|
+
* console.log(value);
|
158
|
+
*
|
159
|
+
* const err = new Error('kaboom');
|
160
|
+
* process.nextTick(() => {
|
161
|
+
* ee.emit('error', err);
|
162
|
+
* });
|
163
|
+
*
|
164
|
+
* try {
|
165
|
+
* await once(ee, 'myevent');
|
166
|
+
* } catch (err) {
|
167
|
+
* console.error('error happened', err);
|
168
|
+
* }
|
169
|
+
* ```
|
170
|
+
*
|
171
|
+
* The special handling of the `'error'` event is only used when `events.once()` is used to wait for another event. If `events.once()` is used to wait for the
|
172
|
+
* '`error'` event itself, then it is treated as any other kind of event without
|
173
|
+
* special handling:
|
174
|
+
*
|
175
|
+
* ```js
|
176
|
+
* import { EventEmitter, once } from 'node:events';
|
177
|
+
*
|
178
|
+
* const ee = new EventEmitter();
|
179
|
+
*
|
180
|
+
* once(ee, 'error')
|
181
|
+
* .then(([err]) => console.log('ok', err.message))
|
182
|
+
* .catch((err) => console.error('error', err.message));
|
183
|
+
*
|
184
|
+
* ee.emit('error', new Error('boom'));
|
185
|
+
*
|
186
|
+
* // Prints: ok boom
|
187
|
+
* ```
|
188
|
+
*
|
189
|
+
* An `AbortSignal` can be used to cancel waiting for the event:
|
190
|
+
*
|
191
|
+
* ```js
|
192
|
+
* import { EventEmitter, once } from 'node:events';
|
193
|
+
*
|
194
|
+
* const ee = new EventEmitter();
|
195
|
+
* const ac = new AbortController();
|
196
|
+
*
|
197
|
+
* async function foo(emitter, event, signal) {
|
198
|
+
* try {
|
199
|
+
* await once(emitter, event, { signal });
|
200
|
+
* console.log('event emitted!');
|
201
|
+
* } catch (error) {
|
202
|
+
* if (error.name === 'AbortError') {
|
203
|
+
* console.error('Waiting for the event was canceled!');
|
204
|
+
* } else {
|
205
|
+
* console.error('There was an error', error.message);
|
206
|
+
* }
|
207
|
+
* }
|
208
|
+
* }
|
209
|
+
*
|
210
|
+
* foo(ee, 'foo', ac.signal);
|
211
|
+
* ac.abort(); // Abort waiting for the event
|
212
|
+
* ee.emit('foo'); // Prints: Waiting for the event was canceled!
|
213
|
+
* ```
|
214
|
+
* @since v11.13.0, v10.16.0
|
215
|
+
*/
|
216
|
+
static once(
|
217
|
+
emitter: NodeJS.EventEmitter,
|
218
|
+
eventName: string | symbol,
|
219
|
+
options?: Pick<StaticEventEmitterOptions, "signal">,
|
220
|
+
): Promise<any[]>;
|
221
|
+
static once(emitter: EventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
|
222
|
+
/**
|
223
|
+
* ```js
|
224
|
+
* import { on, EventEmitter } from 'node:events';
|
225
|
+
* import process from 'node:process';
|
226
|
+
*
|
227
|
+
* const ee = new EventEmitter();
|
228
|
+
*
|
229
|
+
* // Emit later on
|
230
|
+
* process.nextTick(() => {
|
231
|
+
* ee.emit('foo', 'bar');
|
232
|
+
* ee.emit('foo', 42);
|
233
|
+
* });
|
234
|
+
*
|
235
|
+
* for await (const event of on(ee, 'foo')) {
|
236
|
+
* // The execution of this inner block is synchronous and it
|
237
|
+
* // processes one event at a time (even with await). Do not use
|
238
|
+
* // if concurrent execution is required.
|
239
|
+
* console.log(event); // prints ['bar'] [42]
|
240
|
+
* }
|
241
|
+
* // Unreachable here
|
242
|
+
* ```
|
243
|
+
*
|
244
|
+
* Returns an `AsyncIterator` that iterates `eventName` events. It will throw
|
245
|
+
* if the `EventEmitter` emits `'error'`. It removes all listeners when
|
246
|
+
* exiting the loop. The `value` returned by each iteration is an array
|
247
|
+
* composed of the emitted event arguments.
|
248
|
+
*
|
249
|
+
* An `AbortSignal` can be used to cancel waiting on events:
|
250
|
+
*
|
251
|
+
* ```js
|
252
|
+
* import { on, EventEmitter } from 'node:events';
|
253
|
+
* import process from 'node:process';
|
254
|
+
*
|
255
|
+
* const ac = new AbortController();
|
256
|
+
*
|
257
|
+
* (async () => {
|
258
|
+
* const ee = new EventEmitter();
|
259
|
+
*
|
260
|
+
* // Emit later on
|
261
|
+
* process.nextTick(() => {
|
262
|
+
* ee.emit('foo', 'bar');
|
263
|
+
* ee.emit('foo', 42);
|
264
|
+
* });
|
265
|
+
*
|
266
|
+
* for await (const event of on(ee, 'foo', { signal: ac.signal })) {
|
267
|
+
* // The execution of this inner block is synchronous and it
|
268
|
+
* // processes one event at a time (even with await). Do not use
|
269
|
+
* // if concurrent execution is required.
|
270
|
+
* console.log(event); // prints ['bar'] [42]
|
271
|
+
* }
|
272
|
+
* // Unreachable here
|
273
|
+
* })();
|
274
|
+
*
|
275
|
+
* process.nextTick(() => ac.abort());
|
276
|
+
* ```
|
277
|
+
* @since v13.6.0, v12.16.0
|
278
|
+
* @param eventName The name of the event being listened for
|
279
|
+
* @return An `AsyncIterator` that iterates `eventName` events emitted by the `emitter`
|
280
|
+
*/
|
281
|
+
static on(
|
282
|
+
emitter: NodeJS.EventEmitter,
|
283
|
+
eventName: string | symbol,
|
284
|
+
options?: StaticEventEmitterOptions,
|
285
|
+
): AsyncIterableIterator<any>;
|
286
|
+
static on(
|
287
|
+
emitter: EventTarget,
|
288
|
+
eventName: string,
|
289
|
+
options?: StaticEventEmitterOptions,
|
290
|
+
): AsyncIterableIterator<any>;
|
291
|
+
/**
|
292
|
+
* A class method that returns the number of listeners for the given `eventName` registered on the given `emitter`.
|
293
|
+
*
|
294
|
+
* ```js
|
295
|
+
* import { EventEmitter, listenerCount } from 'node:events';
|
296
|
+
*
|
297
|
+
* const myEmitter = new EventEmitter();
|
298
|
+
* myEmitter.on('event', () => {});
|
299
|
+
* myEmitter.on('event', () => {});
|
300
|
+
* console.log(listenerCount(myEmitter, 'event'));
|
301
|
+
* // Prints: 2
|
302
|
+
* ```
|
303
|
+
* @since v0.9.12
|
304
|
+
* @deprecated Since v3.2.0 - Use `listenerCount` instead.
|
305
|
+
* @param emitter The emitter to query
|
306
|
+
* @param eventName The event name
|
307
|
+
*/
|
308
|
+
static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number;
|
309
|
+
/**
|
310
|
+
* Returns a copy of the array of listeners for the event named `eventName`.
|
311
|
+
*
|
312
|
+
* For `EventEmitter`s this behaves exactly the same as calling `.listeners` on
|
313
|
+
* the emitter.
|
314
|
+
*
|
315
|
+
* For `EventTarget`s this is the only way to get the event listeners for the
|
316
|
+
* event target. This is useful for debugging and diagnostic purposes.
|
317
|
+
*
|
318
|
+
* ```js
|
319
|
+
* import { getEventListeners, EventEmitter } from 'node:events';
|
320
|
+
*
|
321
|
+
* {
|
322
|
+
* const ee = new EventEmitter();
|
323
|
+
* const listener = () => console.log('Events are fun');
|
324
|
+
* ee.on('foo', listener);
|
325
|
+
* console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
|
326
|
+
* }
|
327
|
+
* {
|
328
|
+
* const et = new EventTarget();
|
329
|
+
* const listener = () => console.log('Events are fun');
|
330
|
+
* et.addEventListener('foo', listener);
|
331
|
+
* console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
|
332
|
+
* }
|
333
|
+
* ```
|
334
|
+
* @since v15.2.0, v14.17.0
|
335
|
+
*/
|
336
|
+
static getEventListeners(emitter: EventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
|
337
|
+
/**
|
338
|
+
* Returns the currently set max amount of listeners.
|
339
|
+
*
|
340
|
+
* For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on
|
341
|
+
* the emitter.
|
342
|
+
*
|
343
|
+
* For `EventTarget`s this is the only way to get the max event listeners for the
|
344
|
+
* event target. If the number of event handlers on a single EventTarget exceeds
|
345
|
+
* the max set, the EventTarget will print a warning.
|
346
|
+
*
|
347
|
+
* ```js
|
348
|
+
* import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
|
349
|
+
*
|
350
|
+
* {
|
351
|
+
* const ee = new EventEmitter();
|
352
|
+
* console.log(getMaxListeners(ee)); // 10
|
353
|
+
* setMaxListeners(11, ee);
|
354
|
+
* console.log(getMaxListeners(ee)); // 11
|
355
|
+
* }
|
356
|
+
* {
|
357
|
+
* const et = new EventTarget();
|
358
|
+
* console.log(getMaxListeners(et)); // 10
|
359
|
+
* setMaxListeners(11, et);
|
360
|
+
* console.log(getMaxListeners(et)); // 11
|
361
|
+
* }
|
362
|
+
* ```
|
363
|
+
* @since v19.9.0
|
364
|
+
*/
|
365
|
+
static getMaxListeners(emitter: EventTarget | NodeJS.EventEmitter): number;
|
366
|
+
/**
|
367
|
+
* ```js
|
368
|
+
* import { setMaxListeners, EventEmitter } from 'node:events';
|
369
|
+
*
|
370
|
+
* const target = new EventTarget();
|
371
|
+
* const emitter = new EventEmitter();
|
372
|
+
*
|
373
|
+
* setMaxListeners(5, target, emitter);
|
374
|
+
* ```
|
375
|
+
* @since v15.4.0
|
376
|
+
* @param n A non-negative number. The maximum number of listeners per `EventTarget` event.
|
377
|
+
* @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter}
|
378
|
+
* objects.
|
379
|
+
*/
|
380
|
+
static setMaxListeners(n?: number, ...eventTargets: Array<EventTarget | NodeJS.EventEmitter>): void;
|
381
|
+
/**
|
382
|
+
* Listens once to the `abort` event on the provided `signal`.
|
383
|
+
*
|
384
|
+
* Listening to the `abort` event on abort signals is unsafe and may
|
385
|
+
* lead to resource leaks since another third party with the signal can
|
386
|
+
* call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change
|
387
|
+
* this since it would violate the web standard. Additionally, the original
|
388
|
+
* API makes it easy to forget to remove listeners.
|
389
|
+
*
|
390
|
+
* This API allows safely using `AbortSignal`s in Node.js APIs by solving these
|
391
|
+
* two issues by listening to the event such that `stopImmediatePropagation` does
|
392
|
+
* not prevent the listener from running.
|
393
|
+
*
|
394
|
+
* Returns a disposable so that it may be unsubscribed from more easily.
|
395
|
+
*
|
396
|
+
* ```js
|
397
|
+
* import { addAbortListener } from 'node:events';
|
398
|
+
*
|
399
|
+
* function example(signal) {
|
400
|
+
* let disposable;
|
401
|
+
* try {
|
402
|
+
* signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
|
403
|
+
* disposable = addAbortListener(signal, (e) => {
|
404
|
+
* // Do something when signal is aborted.
|
405
|
+
* });
|
406
|
+
* } finally {
|
407
|
+
* disposable?.[Symbol.dispose]();
|
408
|
+
* }
|
409
|
+
* }
|
410
|
+
* ```
|
411
|
+
* @since v20.5.0
|
412
|
+
* @experimental
|
413
|
+
* @return Disposable that removes the `abort` listener.
|
414
|
+
*/
|
415
|
+
static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
|
416
|
+
/**
|
417
|
+
* This symbol shall be used to install a listener for only monitoring `'error'` events. Listeners installed using this symbol are called before the regular `'error'` listeners are called.
|
418
|
+
*
|
419
|
+
* Installing a listener using this symbol does not change the behavior once an `'error'` event is emitted. Therefore, the process will still crash if no
|
420
|
+
* regular `'error'` listener is installed.
|
421
|
+
* @since v13.6.0, v12.17.0
|
422
|
+
*/
|
423
|
+
static readonly errorMonitor: unique symbol;
|
424
|
+
/**
|
425
|
+
* Value: `Symbol.for('nodejs.rejection')`
|
426
|
+
*
|
427
|
+
* See how to write a custom `rejection handler`.
|
428
|
+
* @since v13.4.0, v12.16.0
|
429
|
+
*/
|
430
|
+
static readonly captureRejectionSymbol: unique symbol;
|
431
|
+
/**
|
432
|
+
* Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)
|
433
|
+
*
|
434
|
+
* Change the default `captureRejections` option on all new `EventEmitter` objects.
|
435
|
+
* @since v13.4.0, v12.16.0
|
436
|
+
*/
|
437
|
+
static captureRejections: boolean;
|
438
|
+
/**
|
439
|
+
* By default, a maximum of `10` listeners can be registered for any single
|
440
|
+
* event. This limit can be changed for individual `EventEmitter` instances
|
441
|
+
* using the `emitter.setMaxListeners(n)` method. To change the default
|
442
|
+
* for _all_`EventEmitter` instances, the `events.defaultMaxListeners` property
|
443
|
+
* can be used. If this value is not a positive number, a `RangeError` is thrown.
|
444
|
+
*
|
445
|
+
* Take caution when setting the `events.defaultMaxListeners` because the
|
446
|
+
* change affects _all_ `EventEmitter` instances, including those created before
|
447
|
+
* the change is made. However, calling `emitter.setMaxListeners(n)` still has
|
448
|
+
* precedence over `events.defaultMaxListeners`.
|
449
|
+
*
|
450
|
+
* This is not a hard limit. The `EventEmitter` instance will allow
|
451
|
+
* more listeners to be added but will output a trace warning to stderr indicating
|
452
|
+
* that a "possible EventEmitter memory leak" has been detected. For any single
|
453
|
+
* `EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()` methods can be used to
|
454
|
+
* temporarily avoid this warning:
|
455
|
+
*
|
456
|
+
* ```js
|
457
|
+
* import { EventEmitter } from 'node:events';
|
458
|
+
* const emitter = new EventEmitter();
|
459
|
+
* emitter.setMaxListeners(emitter.getMaxListeners() + 1);
|
460
|
+
* emitter.once('event', () => {
|
461
|
+
* // do stuff
|
462
|
+
* emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
|
463
|
+
* });
|
464
|
+
* ```
|
465
|
+
*
|
466
|
+
* The `--trace-warnings` command-line flag can be used to display the
|
467
|
+
* stack trace for such warnings.
|
468
|
+
*
|
469
|
+
* The emitted warning can be inspected with `process.on('warning')` and will
|
470
|
+
* have the additional `emitter`, `type`, and `count` properties, referring to
|
471
|
+
* the event emitter instance, the event's name and the number of attached
|
472
|
+
* listeners, respectively.
|
473
|
+
* Its `name` property is set to `'MaxListenersExceededWarning'`.
|
474
|
+
* @since v0.11.2
|
475
|
+
*/
|
476
|
+
static defaultMaxListeners: number;
|
477
|
+
}
|
478
|
+
import internal = require("node:events");
|
479
|
+
namespace EventEmitter {
|
480
|
+
// Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
|
481
|
+
export { internal as EventEmitter };
|
482
|
+
export interface Abortable {
|
483
|
+
/**
|
484
|
+
* When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
|
485
|
+
*/
|
486
|
+
signal?: AbortSignal | undefined;
|
487
|
+
}
|
488
|
+
|
489
|
+
export interface EventEmitterReferencingAsyncResource extends AsyncResource {
|
490
|
+
readonly eventEmitter: EventEmitterAsyncResource;
|
491
|
+
}
|
492
|
+
|
493
|
+
export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions {
|
494
|
+
/**
|
495
|
+
* The type of async event, this is required when instantiating `EventEmitterAsyncResource`
|
496
|
+
* directly rather than as a child class.
|
497
|
+
* @default new.target.name if instantiated as a child class.
|
498
|
+
*/
|
499
|
+
name?: string;
|
500
|
+
}
|
501
|
+
|
502
|
+
/**
|
503
|
+
* Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that
|
504
|
+
* require manual async tracking. Specifically, all events emitted by instances
|
505
|
+
* of `events.EventEmitterAsyncResource` will run within its `async context`.
|
506
|
+
*
|
507
|
+
* ```js
|
508
|
+
* import { EventEmitterAsyncResource, EventEmitter } from 'node:events';
|
509
|
+
* import { notStrictEqual, strictEqual } from 'node:assert';
|
510
|
+
* import { executionAsyncId, triggerAsyncId } from 'node:async_hooks';
|
511
|
+
*
|
512
|
+
* // Async tracking tooling will identify this as 'Q'.
|
513
|
+
* const ee1 = new EventEmitterAsyncResource({ name: 'Q' });
|
514
|
+
*
|
515
|
+
* // 'foo' listeners will run in the EventEmitters async context.
|
516
|
+
* ee1.on('foo', () => {
|
517
|
+
* strictEqual(executionAsyncId(), ee1.asyncId);
|
518
|
+
* strictEqual(triggerAsyncId(), ee1.triggerAsyncId);
|
519
|
+
* });
|
520
|
+
*
|
521
|
+
* const ee2 = new EventEmitter();
|
522
|
+
*
|
523
|
+
* // 'foo' listeners on ordinary EventEmitters that do not track async
|
524
|
+
* // context, however, run in the same async context as the emit().
|
525
|
+
* ee2.on('foo', () => {
|
526
|
+
* notStrictEqual(executionAsyncId(), ee2.asyncId);
|
527
|
+
* notStrictEqual(triggerAsyncId(), ee2.triggerAsyncId);
|
528
|
+
* });
|
529
|
+
*
|
530
|
+
* Promise.resolve().then(() => {
|
531
|
+
* ee1.emit('foo');
|
532
|
+
* ee2.emit('foo');
|
533
|
+
* });
|
534
|
+
* ```
|
535
|
+
*
|
536
|
+
* The `EventEmitterAsyncResource` class has the same methods and takes the
|
537
|
+
* same options as `EventEmitter` and `AsyncResource` themselves.
|
538
|
+
* @since v17.4.0, v16.14.0
|
539
|
+
*/
|
540
|
+
export class EventEmitterAsyncResource extends EventEmitter {
|
541
|
+
/**
|
542
|
+
* @param options Only optional in child class.
|
543
|
+
*/
|
544
|
+
constructor(options?: EventEmitterAsyncResourceOptions);
|
545
|
+
/**
|
546
|
+
* Call all `destroy` hooks. This should only ever be called once. An error will
|
547
|
+
* be thrown if it is called more than once. This **must** be manually called. If
|
548
|
+
* the resource is left to be collected by the GC then the `destroy` hooks will
|
549
|
+
* never be called.
|
550
|
+
*/
|
551
|
+
emitDestroy(): void;
|
552
|
+
/**
|
553
|
+
* The unique `asyncId` assigned to the resource.
|
554
|
+
*/
|
555
|
+
readonly asyncId: number;
|
556
|
+
/**
|
557
|
+
* The same triggerAsyncId that is passed to the AsyncResource constructor.
|
558
|
+
*/
|
559
|
+
readonly triggerAsyncId: number;
|
560
|
+
/**
|
561
|
+
* The returned `AsyncResource` object has an additional `eventEmitter` property
|
562
|
+
* that provides a reference to this `EventEmitterAsyncResource`.
|
563
|
+
*/
|
564
|
+
readonly asyncResource: EventEmitterReferencingAsyncResource;
|
565
|
+
}
|
566
|
+
}
|
567
|
+
global {
|
568
|
+
namespace NodeJS {
|
569
|
+
interface EventEmitter<T extends EventMap<T> = DefaultEventMap> {
|
570
|
+
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: Key<K, T>, ...args: Args<K, T>): void;
|
571
|
+
/**
|
572
|
+
* Alias for `emitter.on(eventName, listener)`.
|
573
|
+
* @since v0.1.26
|
574
|
+
*/
|
575
|
+
addListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
576
|
+
/**
|
577
|
+
* Adds the `listener` function to the end of the listeners array for the event
|
578
|
+
* named `eventName`. No checks are made to see if the `listener` has already
|
579
|
+
* been added. Multiple calls passing the same combination of `eventName` and
|
580
|
+
* `listener` will result in the `listener` being added, and called, multiple times.
|
581
|
+
*
|
582
|
+
* ```js
|
583
|
+
* server.on('connection', (stream) => {
|
584
|
+
* console.log('someone connected!');
|
585
|
+
* });
|
586
|
+
* ```
|
587
|
+
*
|
588
|
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
589
|
+
*
|
590
|
+
* By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the
|
591
|
+
* event listener to the beginning of the listeners array.
|
592
|
+
*
|
593
|
+
* ```js
|
594
|
+
* import { EventEmitter } from 'node:events';
|
595
|
+
* const myEE = new EventEmitter();
|
596
|
+
* myEE.on('foo', () => console.log('a'));
|
597
|
+
* myEE.prependListener('foo', () => console.log('b'));
|
598
|
+
* myEE.emit('foo');
|
599
|
+
* // Prints:
|
600
|
+
* // b
|
601
|
+
* // a
|
602
|
+
* ```
|
603
|
+
* @since v0.1.101
|
604
|
+
* @param eventName The name of the event.
|
605
|
+
* @param listener The callback function
|
606
|
+
*/
|
607
|
+
on<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
608
|
+
/**
|
609
|
+
* Adds a **one-time** `listener` function for the event named `eventName`. The
|
610
|
+
* next time `eventName` is triggered, this listener is removed and then invoked.
|
611
|
+
*
|
612
|
+
* ```js
|
613
|
+
* server.once('connection', (stream) => {
|
614
|
+
* console.log('Ah, we have our first user!');
|
615
|
+
* });
|
616
|
+
* ```
|
617
|
+
*
|
618
|
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
619
|
+
*
|
620
|
+
* By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the
|
621
|
+
* event listener to the beginning of the listeners array.
|
622
|
+
*
|
623
|
+
* ```js
|
624
|
+
* import { EventEmitter } from 'node:events';
|
625
|
+
* const myEE = new EventEmitter();
|
626
|
+
* myEE.once('foo', () => console.log('a'));
|
627
|
+
* myEE.prependOnceListener('foo', () => console.log('b'));
|
628
|
+
* myEE.emit('foo');
|
629
|
+
* // Prints:
|
630
|
+
* // b
|
631
|
+
* // a
|
632
|
+
* ```
|
633
|
+
* @since v0.3.0
|
634
|
+
* @param eventName The name of the event.
|
635
|
+
* @param listener The callback function
|
636
|
+
*/
|
637
|
+
once<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
638
|
+
/**
|
639
|
+
* Removes the specified `listener` from the listener array for the event named `eventName`.
|
640
|
+
*
|
641
|
+
* ```js
|
642
|
+
* const callback = (stream) => {
|
643
|
+
* console.log('someone connected!');
|
644
|
+
* };
|
645
|
+
* server.on('connection', callback);
|
646
|
+
* // ...
|
647
|
+
* server.removeListener('connection', callback);
|
648
|
+
* ```
|
649
|
+
*
|
650
|
+
* `removeListener()` will remove, at most, one instance of a listener from the
|
651
|
+
* listener array. If any single listener has been added multiple times to the
|
652
|
+
* listener array for the specified `eventName`, then `removeListener()` must be
|
653
|
+
* called multiple times to remove each instance.
|
654
|
+
*
|
655
|
+
* Once an event is emitted, all listeners attached to it at the
|
656
|
+
* time of emitting are called in order. This implies that any `removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
|
657
|
+
* will not remove them from`emit()` in progress. Subsequent events behave as expected.
|
658
|
+
*
|
659
|
+
* ```js
|
660
|
+
* import { EventEmitter } from 'node:events';
|
661
|
+
* class MyEmitter extends EventEmitter {}
|
662
|
+
* const myEmitter = new MyEmitter();
|
663
|
+
*
|
664
|
+
* const callbackA = () => {
|
665
|
+
* console.log('A');
|
666
|
+
* myEmitter.removeListener('event', callbackB);
|
667
|
+
* };
|
668
|
+
*
|
669
|
+
* const callbackB = () => {
|
670
|
+
* console.log('B');
|
671
|
+
* };
|
672
|
+
*
|
673
|
+
* myEmitter.on('event', callbackA);
|
674
|
+
*
|
675
|
+
* myEmitter.on('event', callbackB);
|
676
|
+
*
|
677
|
+
* // callbackA removes listener callbackB but it will still be called.
|
678
|
+
* // Internal listener array at time of emit [callbackA, callbackB]
|
679
|
+
* myEmitter.emit('event');
|
680
|
+
* // Prints:
|
681
|
+
* // A
|
682
|
+
* // B
|
683
|
+
*
|
684
|
+
* // callbackB is now removed.
|
685
|
+
* // Internal listener array [callbackA]
|
686
|
+
* myEmitter.emit('event');
|
687
|
+
* // Prints:
|
688
|
+
* // A
|
689
|
+
* ```
|
690
|
+
*
|
691
|
+
* Because listeners are managed using an internal array, calling this will
|
692
|
+
* change the position indices of any listener registered _after_ the listener
|
693
|
+
* being removed. This will not impact the order in which listeners are called,
|
694
|
+
* but it means that any copies of the listener array as returned by
|
695
|
+
* the `emitter.listeners()` method will need to be recreated.
|
696
|
+
*
|
697
|
+
* When a single function has been added as a handler multiple times for a single
|
698
|
+
* event (as in the example below), `removeListener()` will remove the most
|
699
|
+
* recently added instance. In the example the `once('ping')` listener is removed:
|
700
|
+
*
|
701
|
+
* ```js
|
702
|
+
* import { EventEmitter } from 'node:events';
|
703
|
+
* const ee = new EventEmitter();
|
704
|
+
*
|
705
|
+
* function pong() {
|
706
|
+
* console.log('pong');
|
707
|
+
* }
|
708
|
+
*
|
709
|
+
* ee.on('ping', pong);
|
710
|
+
* ee.once('ping', pong);
|
711
|
+
* ee.removeListener('ping', pong);
|
712
|
+
*
|
713
|
+
* ee.emit('ping');
|
714
|
+
* ee.emit('ping');
|
715
|
+
* ```
|
716
|
+
*
|
717
|
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
718
|
+
* @since v0.1.26
|
719
|
+
*/
|
720
|
+
removeListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
721
|
+
/**
|
722
|
+
* Alias for `emitter.removeListener()`.
|
723
|
+
* @since v10.0.0
|
724
|
+
*/
|
725
|
+
off<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
726
|
+
/**
|
727
|
+
* Removes all listeners, or those of the specified `eventName`.
|
728
|
+
*
|
729
|
+
* It is bad practice to remove listeners added elsewhere in the code,
|
730
|
+
* particularly when the `EventEmitter` instance was created by some other
|
731
|
+
* component or module (e.g. sockets or file streams).
|
732
|
+
*
|
733
|
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
734
|
+
* @since v0.1.26
|
735
|
+
*/
|
736
|
+
removeAllListeners(eventName?: Key<unknown, T>): this;
|
737
|
+
/**
|
738
|
+
* By default `EventEmitter`s will print a warning if more than `10` listeners are
|
739
|
+
* added for a particular event. This is a useful default that helps finding
|
740
|
+
* memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
|
741
|
+
* modified for this specific `EventEmitter` instance. The value can be set to `Infinity` (or `0`) to indicate an unlimited number of listeners.
|
742
|
+
*
|
743
|
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
744
|
+
* @since v0.3.5
|
745
|
+
*/
|
746
|
+
setMaxListeners(n: number): this;
|
747
|
+
/**
|
748
|
+
* Returns the current max listener value for the `EventEmitter` which is either
|
749
|
+
* set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}.
|
750
|
+
* @since v1.0.0
|
751
|
+
*/
|
752
|
+
getMaxListeners(): number;
|
753
|
+
/**
|
754
|
+
* Returns a copy of the array of listeners for the event named `eventName`.
|
755
|
+
*
|
756
|
+
* ```js
|
757
|
+
* server.on('connection', (stream) => {
|
758
|
+
* console.log('someone connected!');
|
759
|
+
* });
|
760
|
+
* console.log(util.inspect(server.listeners('connection')));
|
761
|
+
* // Prints: [ [Function] ]
|
762
|
+
* ```
|
763
|
+
* @since v0.1.26
|
764
|
+
*/
|
765
|
+
listeners<K>(eventName: Key<K, T>): Array<Listener2<K, T>>;
|
766
|
+
/**
|
767
|
+
* Returns a copy of the array of listeners for the event named `eventName`,
|
768
|
+
* including any wrappers (such as those created by `.once()`).
|
769
|
+
*
|
770
|
+
* ```js
|
771
|
+
* import { EventEmitter } from 'node:events';
|
772
|
+
* const emitter = new EventEmitter();
|
773
|
+
* emitter.once('log', () => console.log('log once'));
|
774
|
+
*
|
775
|
+
* // Returns a new Array with a function `onceWrapper` which has a property
|
776
|
+
* // `listener` which contains the original listener bound above
|
777
|
+
* const listeners = emitter.rawListeners('log');
|
778
|
+
* const logFnWrapper = listeners[0];
|
779
|
+
*
|
780
|
+
* // Logs "log once" to the console and does not unbind the `once` event
|
781
|
+
* logFnWrapper.listener();
|
782
|
+
*
|
783
|
+
* // Logs "log once" to the console and removes the listener
|
784
|
+
* logFnWrapper();
|
785
|
+
*
|
786
|
+
* emitter.on('log', () => console.log('log persistently'));
|
787
|
+
* // Will return a new Array with a single function bound by `.on()` above
|
788
|
+
* const newListeners = emitter.rawListeners('log');
|
789
|
+
*
|
790
|
+
* // Logs "log persistently" twice
|
791
|
+
* newListeners[0]();
|
792
|
+
* emitter.emit('log');
|
793
|
+
* ```
|
794
|
+
* @since v9.4.0
|
795
|
+
*/
|
796
|
+
rawListeners<K>(eventName: Key<K, T>): Array<Listener2<K, T>>;
|
797
|
+
/**
|
798
|
+
* Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments
|
799
|
+
* to each.
|
800
|
+
*
|
801
|
+
* Returns `true` if the event had listeners, `false` otherwise.
|
802
|
+
*
|
803
|
+
* ```js
|
804
|
+
* import { EventEmitter } from 'node:events';
|
805
|
+
* const myEmitter = new EventEmitter();
|
806
|
+
*
|
807
|
+
* // First listener
|
808
|
+
* myEmitter.on('event', function firstListener() {
|
809
|
+
* console.log('Helloooo! first listener');
|
810
|
+
* });
|
811
|
+
* // Second listener
|
812
|
+
* myEmitter.on('event', function secondListener(arg1, arg2) {
|
813
|
+
* console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
|
814
|
+
* });
|
815
|
+
* // Third listener
|
816
|
+
* myEmitter.on('event', function thirdListener(...args) {
|
817
|
+
* const parameters = args.join(', ');
|
818
|
+
* console.log(`event with parameters ${parameters} in third listener`);
|
819
|
+
* });
|
820
|
+
*
|
821
|
+
* console.log(myEmitter.listeners('event'));
|
822
|
+
*
|
823
|
+
* myEmitter.emit('event', 1, 2, 3, 4, 5);
|
824
|
+
*
|
825
|
+
* // Prints:
|
826
|
+
* // [
|
827
|
+
* // [Function: firstListener],
|
828
|
+
* // [Function: secondListener],
|
829
|
+
* // [Function: thirdListener]
|
830
|
+
* // ]
|
831
|
+
* // Helloooo! first listener
|
832
|
+
* // event with parameters 1, 2 in second listener
|
833
|
+
* // event with parameters 1, 2, 3, 4, 5 in third listener
|
834
|
+
* ```
|
835
|
+
* @since v0.1.26
|
836
|
+
*/
|
837
|
+
emit<K>(eventName: Key<K, T>, ...args: Args<K, T>): boolean;
|
838
|
+
/**
|
839
|
+
* Returns the number of listeners listening for the event named `eventName`.
|
840
|
+
* If `listener` is provided, it will return how many times the listener is found
|
841
|
+
* in the list of the listeners of the event.
|
842
|
+
* @since v3.2.0
|
843
|
+
* @param eventName The name of the event being listened for
|
844
|
+
* @param listener The event handler function
|
845
|
+
*/
|
846
|
+
listenerCount<K>(eventName: Key<K, T>, listener?: Listener2<K, T>): number;
|
847
|
+
/**
|
848
|
+
* Adds the `listener` function to the _beginning_ of the listeners array for the
|
849
|
+
* event named `eventName`. No checks are made to see if the `listener` has
|
850
|
+
* already been added. Multiple calls passing the same combination of `eventName`
|
851
|
+
* and `listener` will result in the `listener` being added, and called, multiple times.
|
852
|
+
*
|
853
|
+
* ```js
|
854
|
+
* server.prependListener('connection', (stream) => {
|
855
|
+
* console.log('someone connected!');
|
856
|
+
* });
|
857
|
+
* ```
|
858
|
+
*
|
859
|
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
860
|
+
* @since v6.0.0
|
861
|
+
* @param eventName The name of the event.
|
862
|
+
* @param listener The callback function
|
863
|
+
*/
|
864
|
+
prependListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
865
|
+
/**
|
866
|
+
* Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this
|
867
|
+
* listener is removed, and then invoked.
|
868
|
+
*
|
869
|
+
* ```js
|
870
|
+
* server.prependOnceListener('connection', (stream) => {
|
871
|
+
* console.log('Ah, we have our first user!');
|
872
|
+
* });
|
873
|
+
* ```
|
874
|
+
*
|
875
|
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
876
|
+
* @since v6.0.0
|
877
|
+
* @param eventName The name of the event.
|
878
|
+
* @param listener The callback function
|
879
|
+
*/
|
880
|
+
prependOnceListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
881
|
+
/**
|
882
|
+
* Returns an array listing the events for which the emitter has registered
|
883
|
+
* listeners. The values in the array are strings or `Symbol`s.
|
884
|
+
*
|
885
|
+
* ```js
|
886
|
+
* import { EventEmitter } from 'node:events';
|
887
|
+
*
|
888
|
+
* const myEE = new EventEmitter();
|
889
|
+
* myEE.on('foo', () => {});
|
890
|
+
* myEE.on('bar', () => {});
|
891
|
+
*
|
892
|
+
* const sym = Symbol('symbol');
|
893
|
+
* myEE.on(sym, () => {});
|
894
|
+
*
|
895
|
+
* console.log(myEE.eventNames());
|
896
|
+
* // Prints: [ 'foo', 'bar', Symbol(symbol) ]
|
897
|
+
* ```
|
898
|
+
* @since v6.0.0
|
899
|
+
*/
|
900
|
+
eventNames(): Array<(string | symbol) & Key2<unknown, T>>;
|
901
|
+
}
|
902
|
+
}
|
903
|
+
}
|
904
|
+
export = EventEmitter;
|
905
|
+
}
|
906
|
+
declare module "node:events" {
|
907
|
+
import events = require("events");
|
908
|
+
export = events;
|
909
|
+
}
|