BaseStatsCollector
A stat collector that initially includes no collector functions.
Example:
const statsCollector = new BaseStatsCollector();
statsCollector.addCollector({name: 'custom', onUpdate: fn});
statsCollector.update([1, 2, 3, 4, 5]);
statsCollector.get();
Constructor Summary
| Public Constructor | ||
| public |
|
|
Method Summary
| Public Methods | ||
| public |
addCollector(collector: Object): undefined Add a collector function that can process data when update() or get() is called. |
|
| public |
addIgnore(name: *) |
|
| public |
get(): * |
|
| public |
reset() |
|
| public |
update(values: ...*) |
|
Public Constructors
public constructor source
Public Methods
public addCollector(collector: Object): undefined source
Add a collector function that can process data when update() or get() is called.
Params:
| Name | Type | Attribute | Description |
| collector | Object | An object with the following properties:
|
Example:
const statCollector = new BaseStatsCollector();
statCollector.addCollector({
name: 'test-sum',
initialValue: 0,
onUpdate: function (prev, state, val) { return prev + val; }
});
public addIgnore(name: *) source
Params:
| Name | Type | Attribute | Description |
| name | * |
public reset() source
public update(values: ...*) source
Params:
| Name | Type | Attribute | Description |
| values | ...* |