{"id":18801866,"url":"https://github.com/mitscherlich/make-cancelable-promise","last_synced_at":"2025-06-27T22:05:38.654Z","repository":{"id":135787909,"uuid":"493736112","full_name":"Mitscherlich/make-cancelable-promise","owner":"Mitscherlich","description":"Make any promise cancelable with AbortController \u0026 AbortSignal","archived":false,"fork":false,"pushed_at":"2022-05-18T16:56:54.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-27T22:04:32.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npm.im/@m9ch/make-cancelable-promise","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mitscherlich.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":"2022-05-18T16:11:21.000Z","updated_at":"2024-04-09T11:29:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"a0f73efc-f8a0-434c-9906-1d55ff3e562d","html_url":"https://github.com/Mitscherlich/make-cancelable-promise","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":"Mitscherlich/ts-lib-starter","purl":"pkg:github/Mitscherlich/make-cancelable-promise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mitscherlich%2Fmake-cancelable-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mitscherlich%2Fmake-cancelable-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mitscherlich%2Fmake-cancelable-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mitscherlich%2Fmake-cancelable-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mitscherlich","download_url":"https://codeload.github.com/Mitscherlich/make-cancelable-promise/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mitscherlich%2Fmake-cancelable-promise/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262341622,"owners_count":23296069,"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":[],"created_at":"2024-11-07T22:25:33.558Z","updated_at":"2025-06-27T22:05:38.634Z","avatar_url":"https://github.com/Mitscherlich.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @m9ch/make-cancelable-promise\n\n[![npm version](https://badgen.net/npm/v/@m9ch/make-cancelable-promise)](https://npm.im/@m9ch/make-cancelable-promise) [![npm downloads](https://badgen.net/npm/dm/@m9ch/make-cancelable-promise)](https://npm.im/@m9ch/make-cancelable-promise)\n\nMake any promise cancelable.\n\n## Install\n\nvia `pnpm`, `yarn` or `npm`:\n\n```bash\npnpm add @m9ch/make-cancelable-promise\n# or\nyarn add @m9ch/make-cancelable-promise\n# or\nnpm i -S @m9ch/make-cancelable-promise\n```\n\n## Usage\n\n```javascript\nimport { makeCancelablePromise } from '@m9ch/make-cancelable-promise'\n\nconst abort = new AbortController()\n\nconst cancelable = makeCancelablePromise(\n  new Promise((resolve, reject) =\u003e {\n    setTimeout(() =\u003e {\n      resolve('done')\n    }, 1000)\n  }),\n  abort.signal\n)\n\nsetTimeout(() =\u003e {\n  cancelable.cancel('The operation was aborted')\n}, 500)\n\n// or with abort signal\nabort.abort()\n\ncancelable.promise\n  .then(console.log)    // =\u003e undefined\n  .catch(console.error) // =\u003e AbortError: The operation was aborted\n```\n\n## License\n\nMIT \u0026copy; [Mitscherlich](https://mitscherlich.me)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitscherlich%2Fmake-cancelable-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitscherlich%2Fmake-cancelable-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitscherlich%2Fmake-cancelable-promise/lists"}