{"id":15390224,"url":"https://github.com/gajus/timeout-idle-promise","last_synced_at":"2025-06-30T21:08:23.497Z","repository":{"id":66001247,"uuid":"219009599","full_name":"gajus/timeout-idle-promise","owner":"gajus","description":"Detects when a promise is idle (does not create asynchronous events) for longer than permitted amount of time.","archived":false,"fork":false,"pushed_at":"2019-11-01T15:22:29.000Z","size":5,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-18T01:42:04.984Z","etag":null,"topics":["promise"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gajus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-01T15:13:17.000Z","updated_at":"2024-10-09T13:26:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"590c90aa-7f08-4639-97cc-d51bc642c461","html_url":"https://github.com/gajus/timeout-idle-promise","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"302a7ba2d051af18c96c66771a515840f9d676bd"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gajus/timeout-idle-promise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Ftimeout-idle-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Ftimeout-idle-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Ftimeout-idle-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Ftimeout-idle-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gajus","download_url":"https://codeload.github.com/gajus/timeout-idle-promise/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Ftimeout-idle-promise/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262850261,"owners_count":23374355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["promise"],"created_at":"2024-10-01T15:05:00.583Z","updated_at":"2025-06-30T21:08:23.458Z","avatar_url":"https://github.com/gajus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# timeout-idle-promise\n\n[![Travis build status](http://img.shields.io/travis/gajus/timeout-idle-promise/master.svg?style=flat-square)](https://travis-ci.org/gajus/timeout-idle-promise)\n[![Coveralls](https://img.shields.io/coveralls/gajus/timeout-idle-promise.svg?style=flat-square)](https://coveralls.io/github/gajus/timeout-idle-promise)\n[![NPM version](http://img.shields.io/npm/v/timeout-idle-promise.svg?style=flat-square)](https://www.npmjs.org/package/timeout-idle-promise)\n[![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)\n[![Twitter Follow](https://img.shields.io/twitter/follow/kuizinas.svg?style=social\u0026label=Follow)](https://twitter.com/kuizinas)\n\nDetects when a promise is idle (does not create asynchronous events) for longer than permitted amount of time.\n\n## API\n\n```js\nimport {\n  timeoutIdlePromise,\n  TimeoutError,\n} from 'timeout-idle-promise';\n\n/**\n * @param {Function} promiseFactory\n * @param {number} maximumIdleTime Idle timeout in milliseconds.\n * @throws TimeoutError\n */\ntimeoutIdlePromise(promiseFactory);\n\n```\n\n## Example Usage\n\n```js\n// Rejected with Idle promise timeout.\ntimeoutIdlePromise(() =\u003e {\n  return new Promise((resolve) =\u003e {\n\n  });\n}, 1000);\n\n// Resolved.\ntimeoutIdlePromise(() =\u003e {\n  return new Promise((resolve) =\u003e {\n    setTimeout(() =\u003e {\n      setTimeout(() =\u003e {\n        setTimeout(() =\u003e {\n          resolve();\n        }, 500);\n      }, 500);\n    }, 500);\n  });\n}, 1000);\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgajus%2Ftimeout-idle-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgajus%2Ftimeout-idle-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgajus%2Ftimeout-idle-promise/lists"}