p-event
It works with any event API in Node.js and the browser (using a bundler).
Official Documentation ↗v5.0.0. Check the official docs for the latest API surface.Installation
npm install p-eventpnpm add p-eventMethods
No methods match this filter.
Overview
It works with any event API in Node.js and the browser (using a bundler). If you want multiple individual events as they are emitted, you can use the pEventIterator() method.
API reference status
This page lists only entry points that appear verbatim in the official README examples: pEvent, error, getOpenReadStream, callback. Parameter and return types are not given by the official README, so signatures are marked unverified.
Errors
The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/sindresorhus/p-event@latest/readme.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:51:26.791Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- Passing an array resolves to unknown, including with TypedEventEmitter, because TypeScript cannot narrow the result to the listed events without also losing the check that rejects unknown event names. (https://cdn.jsdelivr.net/gh/sindresorhus/p-event@latest/readme.md)
- If you want to handle filter errors gracefully, wrap your filter logic in a try-catch block and return false for invalid events. (https://cdn.jsdelivr.net/gh/sindresorhus/p-event@latest/readme.md)
- The iterator ends when emitter emits an event matching any of the events defined in resolutionEvents, or rejects if emitter emits any of the events defined in the rejectionEvents option. (https://cdn.jsdelivr.net/gh/sindresorhus/p-event@latest/readme.md)
Verification notes
- Official source: https://github.com/sindresorhus/p-event
- Evidence: https://cdn.jsdelivr.net/gh/sindresorhus/p-event@latest/readme.md
- Checked on 2026-11-04 by
scripts/phase11/build-api-profiles.mjs
API reference evidence
Fetched from official sources on 2026-11-08T18:09:00+08:00 via WebFetch https://raw.githubusercontent.com/sindresorhus/p-event/main/index.d.ts(返回空);WebFetch https://cdn.jsdelivr.net/gh/sindresorhus/p-event@latest/index.d.ts;WebFetch https://cdn.jsdelivr.net/gh/sindresorhus/p-event@latest/readme.md.
pEvent→ signature from https://cdn.jsdelivr.net/gh/sindresorhus/p-event@latest/index.d.ts; official text: “export function pEvent<EventName extends string | symbol, EmittedType>( emitter: Emitter<EventName, [EmittedType]>, event: string | symbol | ReadonlyArray<string | symbol>, options?: Options, ): CancelablePr”
FAQ
- What does p-event do?
- It works with any event API in Node.js and the browser (using a bundler).
- How do I install p-event?
- Run `npm install p-event`.
- Where can I verify the API details?
- Official repository/documentation: https://github.com/sindresorhus/p-event. Checked on 2026-11-04; signatures and return values not stated in the official README are marked unverified.
Report a problem with this API docOpens a pre-filled issue on GitHub.