8000 GitHub - aermin/web-locks at 0.3.0
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

aermin/web-locks

Repository files navigation

web-locks

A polyfill of Web Locks API with localstorage, support the mainstream browsers usage

usage:

install this lib

npm i navigator.locks

import this lib and use it follow Web Locks API

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.
});

online demo

demo link

you could open this url in two tabs, operate the lock buttons and see the page and console

process:

  • lock.request

    • lock.request option -> mode
    • lock.request option -> ifAvailable
    • lock.request option -> steal
    • lock.request option -> 1signal
  • lock.query

  • CI/CD

  • Unit test

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0