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