Barrier class
Barrier is a one-time signal that can be used in like ready states, close events etc.
it's basically a special type of promise with no resolve value and will never reject.
Signature:
export declare class Barrier implements PromiseLike<void>
Implements: PromiseLike<void>
Example
const serverReady = new Barrier()
server.on('listening', () => barrier.unlock())
await serverReady
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)() | Constructs a new instance of the Barrier class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
unlocked | boolean |
Methods
Method | Modifiers | Description |
---|---|---|
then(onfulfilled, onrejected) | ||
unlock() |