support Web Locks API work in major browsers
npm install @mtt/navigator.locksA polyfill of Web Locks API with localstorage, support the mainstream browsers usage
- implement features according to Web Locks API Specification
- implement the unit test according to web-platform-test
- implement all the features of Web Locks API
install this lib
```
npm i navigator.locks
import this lib and use it follow Web Locks API
`js
import locks from "navigator.locks";
locks.request("my_resource", async (lock) => {
// The lock has been acquired.
await do_something();
await do_something_else();
// Now the lock will be released.
});
`
> you could open this url in two tabs, operate the lock buttons and see the page and console
- [x] lock.request
- [x] lock.request option -> modeifAvailable
- [x] lock.request option -> steal
- [x] lock.request option -> 1signal`
- [x] lock.request option ->
- [x] lock.query
- [x] CI/CD
- [x] Unit test