{"id":24831621,"url":"https://github.com/oliver-oloughlin/async_lock","last_synced_at":"2026-05-05T10:38:28.192Z","repository":{"id":274369444,"uuid":"922692202","full_name":"oliver-oloughlin/async_lock","owner":"oliver-oloughlin","description":"Simple and small-weight async lock for running callback functions sequentially, with zero dependencies.","archived":false,"fork":false,"pushed_at":"2025-02-16T13:34:33.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T14:42:25.883Z","etag":null,"topics":["async-lock","deno","javascript","jsr","lock","typescript"],"latest_commit_sha":null,"homepage":"https://jsr.io/@olli/async-lock","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/oliver-oloughlin.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":"2025-01-26T21:15:57.000Z","updated_at":"2025-02-16T13:33:54.000Z","dependencies_parsed_at":"2025-01-26T22:21:09.780Z","dependency_job_id":"c1fcbefa-408e-4fe7-9b77-bfbeb85561e8","html_url":"https://github.com/oliver-oloughlin/async_lock","commit_stats":null,"previous_names":["oliver-oloughlin/async_lock"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliver-oloughlin%2Fasync_lock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliver-oloughlin%2Fasync_lock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliver-oloughlin%2Fasync_lock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliver-oloughlin%2Fasync_lock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oliver-oloughlin","download_url":"https://codeload.github.com/oliver-oloughlin/async_lock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245579675,"owners_count":20638679,"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":["async-lock","deno","javascript","jsr","lock","typescript"],"created_at":"2025-01-31T00:35:32.259Z","updated_at":"2025-10-18T19:02:41.726Z","avatar_url":"https://github.com/oliver-oloughlin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async_lock\n\nSimple and small-weight async lock for running callback functions sequentially,\nwith zero dependencies.\n\n## Run\n\nSequentially run tasks using a queue based strategy. New tasks are queued and\nwait for prior tasks to complete.\n\n```ts\nimport { AsyncLock } from \"@olli/async-lock\";\n\nconst lock = new AsyncLock();\n\nasync function critical() {\n  // ...critical logic that needs to be run one instance at a time\n}\n\n// All calls of `critical()` are run sequentially, no matter the order\nawait Promise.all([\n  lock.run(() =\u003e critical()),\n  lock.run(() =\u003e critical()),\n  lock.run(() =\u003e critical()),\n]);\n```\n\n## Cancel\n\nCancel and remove any queued tasks.\n\n```ts\nimport { AsyncLock } from \"@olli/async-lock\";\n\nconst lock = new AsyncLock();\n\nasync function critical() {\n  // ...critical logic that needs to be run one instance at a time\n}\n\nPromise.all([\n  lock.run(() =\u003e critical()), // Not cancelled, as the first task does not need to wait\n  lock.run(() =\u003e critical()), // Cancelled\n  lock.run(() =\u003e critical()), // Cancelled\n]);\n\nlock.cancel();\n```\n\n## Development\n\nAny contributions are welcomed and appreciated. How to contribute:\n\n- Clone this repository\n- Add feature / Refactor\n- Add or refactor tests as needed\n- Ensure code quality (check + lint + format + test) using `deno task prep`\n- Open Pull Request\n\n## License\n\nPublished under\n[MIT License](https://github.com/oliver-oloughlin/async_lock/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliver-oloughlin%2Fasync_lock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foliver-oloughlin%2Fasync_lock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliver-oloughlin%2Fasync_lock/lists"}