{"library":"await-timeout","type":"library","category":null,"description":"await-timeout, currently at version 1.1.1, offers a Promise-based API for handling `setTimeout` and `clearTimeout` in JavaScript, making it particularly useful within `async/await` constructs. It simplifies common asynchronous patterns such as adding timeouts to network requests or other long-running operations. The library provides both static methods like `Timeout.set(ms)` for simple delays and instance methods (`new Timeout().set(ms)`) for more controlled scenarios, including wrapping existing promises with timeouts using `Timeout.wrap(promise, ms, rejectReason)`. A key differentiator is its emphasis on proper resource management, advising the use of `.clear()` within `finally` blocks to prevent unhandled promise rejections or 'unexpected effects' when dealing with `Promise.race`. While a specific release cadence isn't detailed, its stable 1.x version implies a mature and focused utility for precise timeout management in asynchronous codebases.","language":"javascript","status":"active","version":"1.1.1","tags":["javascript","timeout","promise","promise-api","promises","settimeout","cleartimeout"],"last_verified":"Wed May 27","install":[{"cmd":"npm install await-timeout","imports":["import Timeout from 'await-timeout';","await Timeout.set(1000);","const timer = new Timeout();"]},{"cmd":"yarn add await-timeout","imports":[]},{"cmd":"pnpm add await-timeout","imports":[]}],"homepage":null,"github":"https://github.com/vitalets/await-timeout","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/await-timeout","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/await-timeout/compatibility"}}