Skip to content

added promisified lock object#15

Open
nirmalgupta wants to merge 3 commits intodominictarr:masterfrom
leverj:master
Open

added promisified lock object#15
nirmalgupta wants to merge 3 commits intodominictarr:masterfrom
leverj:master

Conversation

@nirmalgupta
Copy link
Copy Markdown

I have added promise wrapper on Lock object. This is an added functionality and does not change any existing one. Usage is

const {AsyncLock}   = require('lock')
const lock = AsyncLock()
lock(['A', 'B', 'C'], function(){
    //do an async operation
    return someAsyncOperation(args)
    
}).then(function(result){
  //A, B & C are now unlocked!
}).catch(function(e){ 
// error thrown by someAsyncOperation(args) 
})

Please review and merge this code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant