Options
All
  • Public
  • Public/Protected
  • All
Menu

创建一个 Lock 对象,用于锁住当前的当前的异步流程

Hierarchy

  • Locker

Constructors

Properties

Methods

Constructors

constructor

  • new Locker(__namedParameters?: object): Locker

Parameters

  • __namedParameters: object = {} Default value
    • limit: number
    • timeout: undefined | number

Returns Locker

Properties

limit

limit: number

限制并发数量,默认为 1

timeout

timeout: number

超时时间,默认为无限

Methods

isLocked

  • isLocked(): boolean

当前是否锁住了

Returns boolean

是否锁住了

lock

  • lock(timeout?: number): Promise<void>

添加异步锁

Parameters

  • timeout: number = this.timeout Default value

    超时时间,默认为全局 timeout

Returns Promise<void>

进行等待

unlock

  • unlock(): void

删除异步锁

Returns void

  • Inherited
  • Protected
  • Private
  • Static
  • Module
  • Object
  • Property
  • Function
  • Variable
  • Index
  • Type
  • Class
  • Interface
  • Enum
  • Constructor
  • Getter/Setter
Made with ❤️ by pirix-gh. Documentation generated by TypeDoc.