Creates a new Counter instance.
The initial value of the counter. Default is 0.
Decrements the counter by one.
The new value of the counter after decrementing.
Increments the counter by one.
The new value of the counter after incrementing.
Resets the counter to zero.
Waits until the counter reaches the specified target value.
The value to wait for.
Optionalsignal: AbortSignal | nullAn optional AbortSignal to cancel the wait.
A counter primitive that can be incremented, decremented, and waited upon.
Example