{"id":15979376,"url":"https://github.com/perry-mitchell/cancellor","last_synced_at":"2026-01-28T01:05:45.924Z","repository":{"id":57193565,"uuid":"401262546","full_name":"perry-mitchell/cancellor","owner":"perry-mitchell","description":"Cancel token generator","archived":false,"fork":false,"pushed_at":"2022-11-21T12:18:13.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-21T16:38:45.520Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/perry-mitchell.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["perry-mitchell"]}},"created_at":"2021-08-30T07:59:10.000Z","updated_at":"2022-11-21T12:18:18.000Z","dependencies_parsed_at":"2023-01-22T18:00:49.878Z","dependency_job_id":null,"html_url":"https://github.com/perry-mitchell/cancellor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/perry-mitchell/cancellor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fcancellor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fcancellor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fcancellor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fcancellor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perry-mitchell","download_url":"https://codeload.github.com/perry-mitchell/cancellor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fcancellor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28831199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T23:29:49.665Z","status":"ssl_error","status_checked_at":"2026-01-27T23:25:58.379Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-10-07T23:42:37.359Z","updated_at":"2026-01-28T01:05:45.908Z","avatar_url":"https://github.com/perry-mitchell.png","language":"JavaScript","funding_links":["https://github.com/sponsors/perry-mitchell"],"categories":[],"sub_categories":[],"readme":"# Cancellor\n\u003e Cancel token generator\n\nGenerate super-simple cancel \"tokens\" that can be used to flag the cancellation of sync and async tasks. Use tokens to detect the need to exit early or throw an exception in one line if a token has been cancelled.\n\n## Why?\n\nThere's a good number of cancel token libraries out there, but many of the maintained ones make use of classes and the like which transpile poorly. I needed something simple and that leaves a very small footprint.\n\n## Installation\n\nSimply install using `npm install cancellor --save`.\n\n## Usage\n\n**Cancellor** exports a `createToken` method:\n\n```typescript\nimport { CancelToken, createToken } from \"cancellor\";\n\nconst token: CancelToken = createToken();\n\ntoken.isCancelled(); // false\n\ntoken.cancel();\n\ntoken.isCancelled(); // true\n\ntoken.throwIfCancelled(); // Error: Token was cancelled\n```\n\nCancel tokens also emit events:\n\n```typescript\nconst removeListener = token.onCancel(() =\u003e {\n    // Fired when `token.cancel()` is called\n});\n\n// later\n\ntoken.cancel();\n```\n\n## Development\n\nThe library is written in typescript and should be developed against NodeJS 14 or newer.\n\nMake sure to install all dependencies (`npm install`) before running any other command. You can build the final source using `npm run build`. Run tests with `npm test`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperry-mitchell%2Fcancellor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperry-mitchell%2Fcancellor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperry-mitchell%2Fcancellor/lists"}