JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 517451
  • Score
    100M100P100Q197481F
  • License MIT

Package Exports

  • lock

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lock) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lock

lock asynchronous resources.

Simple Example

var Lock = require('lock')
var lock = Lock()

lock('key', function (release) { //called when resource is available.

  //do an async operation, and wrap the callback with release.
  someAsyncOperation(args,..., release(function (err) {
    //'key' is not unlocked!
  })
})

Multiple Locks at Once.

var Lock = require('lock')
var lock = Lock()

lock(['A', 'B', 'C'], function (release) { //called, when ALL
                                           //resources are available.

  //do an async operation, and wrap the callback with release(cb)
  someAsyncOperation(args,..., release(function (err) {
    //A, B & C are now unlocked!
  })
})

used in level-update

License

MIT