@ac-essentials/misc-util
    Preparing search index...

    Class Counter

    A counter primitive that can be incremented, decremented, and waited upon.

    const counter = new Counter(0);

    // Increment the counter
    counter.increment();
    // Decrement the counter
    counter.decrement();

    // Wait for the counter to reach a specific value
    await counter.wait(5);
    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    Methods

    • Waits until the counter reaches the specified target value.

      Parameters

      • targetValue: number

        The value to wait for.

      • Optionalsignal: AbortSignal | null

        An optional AbortSignal to cancel the wait.

      Returns Promise<void>