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 n
number Decrement the counter by n. Defaults to 1.
- Source:
-
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 n
number Increment the counter by n. Defaults to 1.
- Source:
-
reset(count)
-
Resets the counter back to count Defaults to 0.
Parameters:
Name Type Description count
number Resets the counter back to count Defaults to 0.
- Source:
-
toJSON()
-
Counters directly return their currently value.
- Implements:
- Source:
Returns:
- Type
- number