git ssb

0+

wanderer🌟 / lockmap



Commit 312a9e92ae190072536e09e92aa1181cfd3ad430

rebuild docs

Signed-off-by: wanderer <mjbecze@gmail.com>
wanderer committed on 8/16/2017, 4:17:48 PM
Parent: 01587eaf141302ad9c7d7c412205e3c0188dcd49

Files changed

README.mdchanged
index.jschanged
package.jsonchanged
README.mdView
@@ -33,31 +33,42 @@
3333 ```
3434
3535 # API
3636
37-## getLock
37 +- [constructor](#constructor)
38 +- [lock](#lock)
39 +- [getLock](#getlock)
3840
39-[index.js:29-31](https://github.com/wanderer/generic-module/blob/7a91dcb08427a3276a9c9da718c759f1631dc1f5/index.js#L29-L31 "Source code on GitHub")
41 +## constructor
4042
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")
4444
45-**Parameters**
45 +Creates a new instance of LockMap
4646
47-- `id`
48-
4947 ## lock
5048
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")
5250
5351 Creates a lock on a given ID and returns a resolve function to unlock the
5452 lock
5553
5654 **Parameters**
5755
58-- `id` **Any**
56 +- `id` **any**
5957
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
6159
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 +
6273 # LICENSE
6374 [MPL-2.0](https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2))
index.jsView
@@ -1,14 +1,17 @@
11 module.exports = class LockMap {
2 + /**
3 + * Creates a new instance of LockMap
4 + */
25 constructor () {
36 this._map = new Map()
47 }
58
69 /**
710 * Creates a lock on a given ID and returns a resolve function to unlock the
811 * lock
912 * @param {*} id
10- * @return {function} the resolve function to call once it to unlock
13 + * @return {Function} the resolve function to call once it to unlock
1114 */
1215 lock (id) {
1316 let r
1417 const promise = new Promise((resolve, reject) => {
@@ -23,9 +26,9 @@
2326
2427 /**
2528 * gets the current lock if any for a given id. If there is a lock this will
2629 * return a promise that resolves once the lock is unlocked
27- * return {Promise}
30 + * @return {Promise}
2831 */
2932 getLock (id) {
3033 return this._map.get(id)
3134 }
package.jsonView
@@ -7,9 +7,9 @@
77 "coverage": "istanbul cover ./tests/index.js",
88 "coveralls": "npm run coverage && coveralls <coverage/lcov.info",
99 "lint": "standard",
1010 "test": "node ./tests/index.js",
11- "build:docs": "documentation --github -f md ./index.js > ./docs/index.md"
11 + "build:docs": "documentation build --github -f md ./index.js > ./docs/index.md"
1212 },
1313 "keywords": [
1414 ""
1515 ],

Built with git-ssb-web