npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

promaphore

1.0.0

@mafintosh

npmHomeRepoSnykSocket
Downloads:2642
$ npm install promaphore
DailyWeeklyMonthlyYearly

promaphore

Promise Semaphore

npm install promaphore

Usage

const Semaphore = require('promaphore')

const s = new Semaphore(2) // 2 is the max operation count

if (await s.wait()) { // wait for the to enter the block (only 2 can be in here at once)
  s.signal() // signal that you are exiting the block
}

If you want to await all pending operations do await s.flush() If you want to signal all pending waits do s.destroy()

License

MIT