new Counter( [properties])
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
properties |
CounterProperties |
<optional> |
- Implements:
- Source:
Example
var Measured = require('measured')
var activeUploads = new Measured.Counter();
http.createServer(function(req, res) {
activeUploads.inc();
req.on('end', function() {
activeUploads.dec();
});
});
Methods
-
dec(n)
-
Decrements the counter
Parameters:
Name Type Description nnumber Decrement the counter by n. Defaults to 1.
-
getType()
-
The type of the Metric Impl. MetricTypes.
- Implements:
- Source:
Returns:
The type of the Metric Impl.
- Type
- string
-
inc(n)
-
Increments the counter.
Parameters:
Name Type Description nnumber Increment the counter by n. Defaults to 1.
-
reset(count)
-
Resets the counter back to count Defaults to 0.
Parameters:
Name Type Description countnumber Resets the counter back to count Defaults to 0.
-
toJSON()
-
Counters directly return their currently value.
- Implements:
- Source:
Returns:
- Type
- number
Measured