Skip to main content

Home > flowp > Barrier

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

ConstructorModifiersDescription
(constructor)()Constructs a new instance of the Barrier class

Properties

PropertyModifiersTypeDescription
unlockedboolean

Methods

MethodModifiersDescription
then(onfulfilled, onrejected)
unlock()