TinyBase logoTinyBase

delMetricDefinition

The delMetricDefinition method removes an existing Metric definition.

delMetricDefinition(metricId: Id): Metrics
TypeDescription
metricIdId

The Id of the Metric to remove.

returnsMetrics

A reference to the Metrics object.

Example

This example creates a Store, creates a Metrics object, defines a simple Metric, and then removes it.

const store = createStore().setTable('species', {
  dog: {price: 5},
  cat: {price: 4},
  worm: {price: 1},
});

const metrics = createMetrics(store);
metrics.setMetricDefinition('speciesCount', 'species');
console.log(metrics.getMetricIds());
// -> ['speciesCount']

metrics.delMetricDefinition('speciesCount');
console.log(metrics.getMetricIds());
// -> []