@lzptec/concurrency
Version:
A Lightweight concurrency manager
2 lines • 663 B
JavaScript
;var chunkZFKFOLTS_cjs=require('./chunk-ZFKFOLTS.cjs');var i,e,o=class{constructor(){chunkZFKFOLTS_cjs.d(this,i,new chunkZFKFOLTS_cjs.h);chunkZFKFOLTS_cjs.d(this,e,false);}async acquire(){if(chunkZFKFOLTS_cjs.c(this,e))return new Promise(t=>chunkZFKFOLTS_cjs.c(this,i).enqueue(t));chunkZFKFOLTS_cjs.e(this,e,true);}async release(){if(chunkZFKFOLTS_cjs.c(this,i).length===0&&chunkZFKFOLTS_cjs.c(this,e)){chunkZFKFOLTS_cjs.e(this,e,false);return}let t=chunkZFKFOLTS_cjs.c(this,i).dequeue();return new Promise(h=>{t(),h();})}};i=new WeakMap,e=new WeakMap;exports.a=o;//# sourceMappingURL=chunk-T2GJZRIQ.cjs.map
//# sourceMappingURL=chunk-T2GJZRIQ.cjs.map