@codevor/js-semaphore
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -143,6 +143,8 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
return new Promise(function (resolve) { | ||
setTimeout(function () { | ||
acquire().then(function () { | ||
var acquireInterval = setInterval(function () { | ||
if (counter > 0) { | ||
counter -= 1; | ||
clearInterval(acquireInterval); | ||
resolve(); | ||
}); | ||
} | ||
}, timespan_timespan() * 1000); | ||
@@ -149,0 +151,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("js-semaphore",[],t):"object"==typeof exports?exports["js-semaphore"]=t():e["js-semaphore"]=t()}("undefined"!=typeof self?self:this,function(){return r={},o.m=n=[function(e,t,n){"use strict";n.r(t);function f(){return i(u)?u:.5}function r(e){i(e)&&(u=e)}function o(e){var t=0<arguments.length&&void 0!==e?e:{},n=t.resources,r=void 0===n?1:n,o=t.start,u=void 0===o?r:o,i=r<=u?r:u;return{acquire:function t(){return 0<i?(i-=1,Promise.resolve()):new Promise(function(e){setTimeout(function(){t().then(function(){e()})},1e3*f())})},release:function(){i<r&&(i+=1)}}}var u,i=function(e){return"number"==typeof e};n.d(t,"Semaphore",function(){return o}),n.d(t,"timespan",function(){return f}),n.d(t,"setTimespan",function(){return r}),n.d(t,"SEMAPHORE_TIMESPAN_SECONDS",function(){return.5})}],o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0);function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}var n,r}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("js-semaphore",[],t):"object"==typeof exports?exports["js-semaphore"]=t():e["js-semaphore"]=t()}("undefined"!=typeof self?self:this,function(){return r={},o.m=n=[function(e,t,n){"use strict";n.r(t);function f(){return i(u)?u:.5}function r(e){i(e)&&(u=e)}function o(e){var t=0<arguments.length&&void 0!==e?e:{},n=t.resources,r=void 0===n?1:n,o=t.start,u=void 0===o?r:o,i=r<=u?r:u;return{acquire:function(){return 0<i?(i-=1,Promise.resolve()):new Promise(function(e){var t=setInterval(function(){0<i&&(i-=1,clearInterval(t),e())},1e3*f())})},release:function(){i<r&&(i+=1)}}}var u,i=function(e){return"number"==typeof e};n.d(t,"Semaphore",function(){return o}),n.d(t,"timespan",function(){return f}),n.d(t,"setTimespan",function(){return r}),n.d(t,"SEMAPHORE_TIMESPAN_SECONDS",function(){return.5})}],o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0);function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}var n,r}); |
{ | ||
"name": "@codevor/js-semaphore", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "🚦Semaphore Implementation for JS", | ||
@@ -5,0 +5,0 @@ "main": "dist/js-semaphore.js", |
Sorry, the diff of this file is not supported yet
25388
208