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