README.mdView |
---|
33 | 33 … | ``` |
34 | 34 … | |
35 | 35 … | # API |
36 | 36 … | |
37 | | -## getLock |
| 37 … | +- [constructor](#constructor) |
| 38 … | +- [lock](#lock) |
| 39 … | +- [getLock](#getlock) |
38 | 40 … | |
39 | | -[index.js:29-31](https://github.com/wanderer/generic-module/blob/7a91dcb08427a3276a9c9da718c759f1631dc1f5/index.js#L29-L31 "Source code on GitHub") |
| 41 … | +## constructor |
40 | 42 … | |
41 | | -gets the current lock if any for a given id. If there is a lock this will |
42 | | -return a promise that resolves once the lock is unlocked |
43 | | -return {Promise} |
| 43 … | +[index.js:5-7](https://github.com/wanderer/lockmap/blob/01587eaf141302ad9c7d7c412205e3c0188dcd49/index.js#L5-L7 "Source code on GitHub") |
44 | 44 … | |
45 | | -**Parameters** |
| 45 … | +Creates a new instance of LockMap |
46 | 46 … | |
47 | | -- `id` |
48 | | - |
49 | 47 … | ## lock |
50 | 48 … | |
51 | | -[index.js:12-22](https://github.com/wanderer/generic-module/blob/7a91dcb08427a3276a9c9da718c759f1631dc1f5/index.js#L12-L22 "Source code on GitHub") |
| 49 … | +[index.js:15-25](https://github.com/wanderer/lockmap/blob/01587eaf141302ad9c7d7c412205e3c0188dcd49/index.js#L15-L25 "Source code on GitHub") |
52 | 50 … | |
53 | 51 … | Creates a lock on a given ID and returns a resolve function to unlock the |
54 | 52 … | lock |
55 | 53 … | |
56 | 54 … | **Parameters** |
57 | 55 … | |
58 | | -- `id` **Any** |
| 56 … | +- `id` **any** |
59 | 57 … | |
60 | | -Returns **function** the resolve function to call once it to unlock |
| 58 … | +Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** the resolve function to call once it to unlock |
61 | 59 … | |
| 60 … | +## getLock |
| 61 … | + |
| 62 … | +[index.js:32-34](https://github.com/wanderer/lockmap/blob/01587eaf141302ad9c7d7c412205e3c0188dcd49/index.js#L32-L34 "Source code on GitHub") |
| 63 … | + |
| 64 … | +gets the current lock if any for a given id. If there is a lock this will |
| 65 … | +return a promise that resolves once the lock is unlocked |
| 66 … | + |
| 67 … | +**Parameters** |
| 68 … | + |
| 69 … | +- `id` |
| 70 … | + |
| 71 … | +Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** |
| 72 … | + |
62 | 73 … | # LICENSE |
63 | 74 … | [MPL-2.0](https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2)) |