Skip to main content

Semaphore

Semaphore allows you to limit the amount of async calls happening between enter() and exit()

This can be useful when limiting the number of http calls, browser api calls, etc either for performance or to work around browser limitations like max Image.decode() calls in chromium being 256.

Index

Constructors

Accessors

Methods

Constructors

constructor

Accessors

publiccount

  • get count(): number
  • Returns number

publicwaiting

  • get waiting(): number
  • Returns number

Methods

publicenter

  • enter(): Promise<unknown>
  • Returns Promise<unknown>

publicexit

  • exit(count?: number): void
  • Parameters

    • count: number = 1

    Returns void

Page Options