{"id":16539805,"url":"https://github.com/aermin/web-locks","last_synced_at":"2025-05-12T03:31:41.767Z","repository":{"id":39756762,"uuid":"314943607","full_name":"aermin/web-locks","owner":"aermin","description":"Web Locks API(navigator.locks) polyfill, implement according to Specification ","archived":false,"fork":false,"pushed_at":"2023-02-20T08:05:02.000Z","size":330,"stargazers_count":60,"open_issues_count":4,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-04T06:03:28.314Z","etag":null,"topics":["navigator-locks","navigator-locks-api-polyfill","navigator-locks-polyfill","web-locks","web-locks-api-polyfill","web-locks-polyfill"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/navigator.locks","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/aermin.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":"2020-11-22T02:26:08.000Z","updated_at":"2025-04-29T07:23:31.000Z","dependencies_parsed_at":"2024-06-18T19:44:17.019Z","dependency_job_id":null,"html_url":"https://github.com/aermin/web-locks","commit_stats":{"total_commits":61,"total_committers":6,"mean_commits":"10.166666666666666","dds":"0.39344262295081966","last_synced_commit":"a2013edd81bec19f4c5b9c45e13e10aef38544a2"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aermin%2Fweb-locks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aermin%2Fweb-locks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aermin%2Fweb-locks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aermin%2Fweb-locks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aermin","download_url":"https://codeload.github.com/aermin/web-locks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253668056,"owners_count":21944969,"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":["navigator-locks","navigator-locks-api-polyfill","navigator-locks-polyfill","web-locks","web-locks-api-polyfill","web-locks-polyfill"],"created_at":"2024-10-11T18:50:40.451Z","updated_at":"2025-05-12T03:31:41.441Z","avatar_url":"https://github.com/aermin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch2 align=\"center\"\u003eweb-locks polyfill\u003c/h2\u003e\n\n\u003ch3 align=\"center\"\u003e\n\n![push workflow](https://github.com/aermin/web-locks/actions/workflows/push.yml/badge.svg)\n![release workflow](https://github.com/aermin/web-locks/actions/workflows/release.yml/badge.svg)\n![npm](https://img.shields.io/npm/v/navigator.locks)\n![license](https://img.shields.io/github/license/aermin/web-locks)\n\n\u003c/h3\u003e\n\na [Web Locks API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API) polyfill, work when the browser does not support web lock API: `navigator.lock`, resolve the browser compatibility issue.\n\n- implement features according to [Web Locks API Specification](https://wicg.github.io/web-locks/)\n\n- implement the unit test according to [web-platform-test](https://github.com/web-platform-tests/wpt/tree/master/web-locks)\n\n- implement all the features of [Web Locks API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API)\n\n## Installation\n\n```\n// with npm\nnpm install navigator.locks\n\n// with yarn\nyarn add navigator.locks\n```\n\n## Usage\n\nJust import It.\n\n```js\nimport \"navigator.locks\";\n\nnavigator.locks.request(\"my_resource\", async (lock) =\u003e {\n  // The lock has been acquired.\n  await do_something();\n  await do_something_else();\n  // Now the lock will be released.\n});\n```\n\n```ts\n// if you use Typescript, could import these types to use\nimport type {\n  LockManager,\n  Lock,\n  LockInfo,\n  LockManagerSnapshot,\n  LocksInfo,\n} from \"navigator.locks\";\n```\n\n\u003e `navigator.locks` API usage follow [MDN API Doc](https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API)\n\n## Online demo\n\n[demo link](https://ytqq5.csb.app/)\n\n\u003e You could open two tabs of this API unsupported browser, operate the lock buttons to experience\n\n## Process\n\n### All API ✅\n\n- navigator.locks.request\n\n- navigator.locks.request options:\n\n  *mode*: `exclusive` | `shared`\n\n  *ifAvailable*\n\n  *steal*\n\n  *signal*\n\n- navigator.locks.query\n\n### CI/CD ✅\n\n### Unit test ✅\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faermin%2Fweb-locks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faermin%2Fweb-locks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faermin%2Fweb-locks/lists"}