async-lock
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -1,3 +0,7 @@ | ||
0.3.0 / 2015-03-6 | ||
0.3.1 / 2015-04-15 | ||
================== | ||
* Use your own promise | ||
0.3.0 / 2015-03-06 | ||
================== | ||
* Domain reentrant | ||
@@ -4,0 +8,0 @@ |
'use strict'; | ||
var Q = require('q'); | ||
var AsyncLock = function(opts){ | ||
opts = opts || {}; | ||
this.Promise = opts.Promise || require('q'); | ||
// format: {key : [fn, fn]} | ||
@@ -48,3 +48,3 @@ // queues[key] = null indicates no job running for key | ||
// will return a promise | ||
deferred = Q.defer(); | ||
deferred = this.Promise.defer(); | ||
} | ||
@@ -111,3 +111,3 @@ | ||
// Promise mode | ||
Q.fcall(function(){ | ||
self.Promise.try(function(){ | ||
return fn(); | ||
@@ -114,0 +114,0 @@ }) |
{ | ||
"name": "async-lock", | ||
"description": "", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"author": "rain1017", | ||
@@ -32,2 +32,3 @@ "private" : false, | ||
"devDependencies": { | ||
"bluebird": "~2.9.24", | ||
"lodash": "~3.3.0", | ||
@@ -34,0 +35,0 @@ "should": "~5.1.0", |
@@ -107,2 +107,5 @@ # async-lock | ||
lock.isBusy(); | ||
// Use your own promise | ||
var lock = new AsyncLock({Promise : require('bluebird')}); | ||
``` | ||
@@ -109,0 +112,0 @@ |
@@ -214,2 +214,8 @@ 'use strict'; | ||
it('use bluebird promise', function(done){ | ||
var lock = new AsyncLock({Promise : require('bluebird')}); | ||
lock.acquire('key', function(){}) | ||
.nodeify(done); | ||
}); | ||
it('invalid parameter', function(done){ | ||
@@ -216,0 +222,0 @@ var lock = new AsyncLock(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19721
433
133
11