- Source:
Example
var exampleCounter = await (new Counter("exampleName")).initialize();
Methods
get() → {number}
Get the current value of the counter. The value is cached in memory, which allows this function to be synchronous.
- Source:
Returns:
The current value of the counter.
- Type
- number
(async) getAndIncrement() → {Promise.<number>}
Increment the value of the counter and return the value prior to
incrementing. Identical to the Promise returned by
counter.incrementAndGet().then(value => return value - 1)
.
- Source:
Returns:
- The counter value before incrementing.
- Type
- Promise.<number>
(async) increment()
Increment the value of the counter, ignoring the value. Identical to
the Promise returned by counter.incrementAndGet.then(value => return)
.
- Source:
(async) incrementAndGet() → {Promise.<number>}
Increment the value of the counter and return the incremented value. The cached counter value is synchronously incremented; the stored counter value is asynchronously incremented.
- Source:
Returns:
- The counter value after incrementing.
- Type
- Promise.<number>
(async) incrementBy(incrementValue)
Increment the value of the counter, ignoring the value. Identical to
the Promise returned by counter.incrementByAndGet.then(value => return)
.
Parameters:
Name | Type | Description |
---|---|---|
incrementValue |
number | The amount to increment the counter. |
- Source:
(async) incrementByAndGet(incrementValue) → {Promise.<number>}
Increment the value of the counter by a number and return the incremented value. The cached counter value is synchronously incremented; the stored counter value is asynchronously incremented.
Parameters:
Name | Type | Description |
---|---|---|
incrementValue |
number | The amount to increment the counter. |
- Source:
Returns:
- The counter value after incrementing.
- Type
- Promise.<number>