Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion coverage.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"tests":1776,"assertions":8848,"lines":{"total":987,"covered":987,"skipped":0,"pct":100},"statements":{"total":1077,"covered":1077,"skipped":0,"pct":100},"functions":{"total":413,"covered":413,"skipped":0,"pct":100},"branches":{"total":359,"covered":359,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}}
{"tests":1777,"assertions":8851,"lines":{"total":987,"covered":987,"skipped":0,"pct":100},"statements":{"total":1077,"covered":1077,"skipped":0,"pct":100},"functions":{"total":413,"covered":413,"skipped":0,"pct":100},"branches":{"total":359,"covered":359,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}}
3 changes: 2 additions & 1 deletion docs/api/all.html
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,8 @@
row<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
cellIds<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
cell<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
<span class="punctuation">}</span></code></pre><div class="table"><table><tr><th></th><th>Type</th><th>Description</th></tr><tr><th><code>tables<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TablesListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>tableIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TableIdsListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>table<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TableListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>rowIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of RowIdsListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>row<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of RowListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>cellIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of CellIdsListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>cell<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of CellListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr></table></div><p>The <code>StoreListenerStats</code> object contains a breakdown of the different types of listener. Totals include both mutator and non-mutator listeners. A <code>StoreListenerStats</code> object is returned from the getListenerStats method, and is only populated in a debug build.</p></section></section></section></section><section class="s2" id="/api/metrics" data-id="m"><h2><code>metrics</code></h2><p>The <code>metrics</code> module of the <a href="#/">TinyBase</a> project provides the ability to create and track metrics and aggregates of the data in <a href="#/api/store/interfaces/store/store"><code>Store</code></a> objects.</p><p>The main entry point to this module is the <a href="#/api/metrics/functions/creation/createmetrics"><code>createMetrics</code></a> function, which returns a new <a href="#/api/metrics/interfaces/metrics/metrics"><code>Metrics</code></a> object. From there, you can create new <a href="#/api/metrics/type-aliases/metric/metric"><code>Metric</code></a> definitions, access the values of those <a href="#/api/metrics/interfaces/metrics/metrics"><code>Metrics</code></a> directly, and register listeners for when they change.</p><section class="s3" id="/api/metrics/interfaces" data-id="m/0"><h3>Interfaces</h3><p>There is one interface, <a href="#/api/metrics/interfaces/metrics/metrics"><code>Metrics</code></a>, within the <a href="#/api/metrics"><code>metrics</code></a> module.</p><section class="s4" id="/api/metrics/interfaces/metrics/metrics" data-id="M"><h4><code>Metrics</code></h4><p>A <code>Metrics</code> object lets you define, query, and listen to, aggregations of <a href="#/api/store/type-aliases/store/cell"><code>Cell</code></a> values within a <a href="#/api/store/type-aliases/store/table"><code>Table</code></a> in a <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p><p>This is useful for counting the number of <a href="#/api/store/type-aliases/store/row"><code>Row</code></a> objects in a <a href="#/api/store/type-aliases/store/table"><code>Table</code></a>, averaging <a href="#/api/store/type-aliases/store/cell"><code>Cell</code></a> values, or efficiently performing any arbitrary aggregations.</p><p>Create a <code>Metrics</code> object easily with the <a href="#/api/metrics/functions/creation/createmetrics"><code>createMetrics</code></a> function. From there, you can add new <a href="#/api/metrics/type-aliases/metric/metric"><code>Metric</code></a> definitions (with the <a href="#/api/metrics/interfaces/metrics/metrics/methods/configuration/setmetricdefinition"><code>setMetricDefinition</code></a> method), query their values (with the <a href="#/api/metrics/interfaces/metrics/metrics/methods/getter/getmetric"><code>getMetric</code></a> method), and add listeners for when they change (with the <a href="#/api/metrics/interfaces/metrics/metrics/methods/listener/addmetriclistener"><code>addMetricListener</code></a> method).</p><p>This module provides a number of predefined and self-explanatory aggregations (&#x27;sum&#x27;, &#x27;avg&#x27;, &#x27;min&#x27;, and &#x27;max&#x27;), and defaults to counting <a href="#/api/store/type-aliases/store/row"><code>Row</code></a> objects when using the <a href="#/api/metrics/interfaces/metrics/metrics/methods/configuration/setmetricdefinition"><code>setMetricDefinition</code></a> method. However, far more complex aggregations can be configured with custom functions.</p><section class="s5"><h5>Example</h5><p>This example shows a very simple lifecycle of a <code>Metrics</code> object: from creation, to adding a definition, getting an <a href="#/api/metrics/type-aliases/metric/metric"><code>Metric</code></a>, and then registering and removing a listener for it.</p><pre><code><span class="keyword">const</span> store <span class="operator">=</span> <span class="function"><a href="#/api/store/functions/creation/createstore">createStore</a></span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">.</span><span class="function"><a href="#/api/store/interfaces/store/store/methods/setter/settable">setTable</a></span><span class="punctuation">(</span><span class="string">'species'</span><span class="punctuation">,</span> <span class="punctuation">{</span>
invalidCell<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
<span class="punctuation">}</span></code></pre><div class="table"><table><tr><th></th><th>Type</th><th>Description</th></tr><tr><th><code>tables<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TablesListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>tableIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TableIdsListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>table<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TableListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>rowIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of RowIdsListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>row<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of RowListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>cellIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of CellIdsListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>cell<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of CellListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>invalidCell<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of InvalidCellListeners registered with the <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr></table></div><p>The <code>StoreListenerStats</code> object contains a breakdown of the different types of listener. Totals include both mutator and non-mutator listeners. A <code>StoreListenerStats</code> object is returned from the getListenerStats method, and is only populated in a debug build.</p></section></section></section></section><section class="s2" id="/api/metrics" data-id="m"><h2><code>metrics</code></h2><p>The <code>metrics</code> module of the <a href="#/">TinyBase</a> project provides the ability to create and track metrics and aggregates of the data in <a href="#/api/store/interfaces/store/store"><code>Store</code></a> objects.</p><p>The main entry point to this module is the <a href="#/api/metrics/functions/creation/createmetrics"><code>createMetrics</code></a> function, which returns a new <a href="#/api/metrics/interfaces/metrics/metrics"><code>Metrics</code></a> object. From there, you can create new <a href="#/api/metrics/type-aliases/metric/metric"><code>Metric</code></a> definitions, access the values of those <a href="#/api/metrics/interfaces/metrics/metrics"><code>Metrics</code></a> directly, and register listeners for when they change.</p><section class="s3" id="/api/metrics/interfaces" data-id="m/0"><h3>Interfaces</h3><p>There is one interface, <a href="#/api/metrics/interfaces/metrics/metrics"><code>Metrics</code></a>, within the <a href="#/api/metrics"><code>metrics</code></a> module.</p><section class="s4" id="/api/metrics/interfaces/metrics/metrics" data-id="M"><h4><code>Metrics</code></h4><p>A <code>Metrics</code> object lets you define, query, and listen to, aggregations of <a href="#/api/store/type-aliases/store/cell"><code>Cell</code></a> values within a <a href="#/api/store/type-aliases/store/table"><code>Table</code></a> in a <a href="#/api/store/interfaces/store/store"><code>Store</code></a>.</p><p>This is useful for counting the number of <a href="#/api/store/type-aliases/store/row"><code>Row</code></a> objects in a <a href="#/api/store/type-aliases/store/table"><code>Table</code></a>, averaging <a href="#/api/store/type-aliases/store/cell"><code>Cell</code></a> values, or efficiently performing any arbitrary aggregations.</p><p>Create a <code>Metrics</code> object easily with the <a href="#/api/metrics/functions/creation/createmetrics"><code>createMetrics</code></a> function. From there, you can add new <a href="#/api/metrics/type-aliases/metric/metric"><code>Metric</code></a> definitions (with the <a href="#/api/metrics/interfaces/metrics/metrics/methods/configuration/setmetricdefinition"><code>setMetricDefinition</code></a> method), query their values (with the <a href="#/api/metrics/interfaces/metrics/metrics/methods/getter/getmetric"><code>getMetric</code></a> method), and add listeners for when they change (with the <a href="#/api/metrics/interfaces/metrics/metrics/methods/listener/addmetriclistener"><code>addMetricListener</code></a> method).</p><p>This module provides a number of predefined and self-explanatory aggregations (&#x27;sum&#x27;, &#x27;avg&#x27;, &#x27;min&#x27;, and &#x27;max&#x27;), and defaults to counting <a href="#/api/store/type-aliases/store/row"><code>Row</code></a> objects when using the <a href="#/api/metrics/interfaces/metrics/metrics/methods/configuration/setmetricdefinition"><code>setMetricDefinition</code></a> method. However, far more complex aggregations can be configured with custom functions.</p><section class="s5"><h5>Example</h5><p>This example shows a very simple lifecycle of a <code>Metrics</code> object: from creation, to adding a definition, getting an <a href="#/api/metrics/type-aliases/metric/metric"><code>Metric</code></a>, and then registering and removing a listener for it.</p><pre><code><span class="keyword">const</span> store <span class="operator">=</span> <span class="function"><a href="#/api/store/functions/creation/createstore">createStore</a></span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">.</span><span class="function"><a href="#/api/store/interfaces/store/store/methods/setter/settable">setTable</a></span><span class="punctuation">(</span><span class="string">'species'</span><span class="punctuation">,</span> <span class="punctuation">{</span>
<span class="literal-property">dog</span><span class="operator">:</span> <span class="punctuation">{</span><span class="literal-property">price</span><span class="operator">:</span> <span class="number">5</span><span class="punctuation">}</span><span class="punctuation">,</span>
<span class="literal-property">cat</span><span class="operator">:</span> <span class="punctuation">{</span><span class="literal-property">price</span><span class="operator">:</span> <span class="number">4</span><span class="punctuation">}</span><span class="punctuation">,</span>
<span class="literal-property">worm</span><span class="operator">:</span> <span class="punctuation">{</span><span class="literal-property">price</span><span class="operator">:</span> <span class="number">1</span><span class="punctuation">}</span><span class="punctuation">,</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
row<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
cellIds<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
cell<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
<span class="punctuation">}</span></code></pre><div class="table"><table><tr><th></th><th>Type</th><th>Description</th></tr><tr><th><code>tables<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TablesListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>tableIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TableIdsListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>table<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TableListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>rowIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of RowIdsListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>row<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of RowListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>cellIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of CellIdsListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>cell<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of CellListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr></table></div><p>The <code>StoreListenerStats</code> object contains a breakdown of the different types of listener. Totals include both mutator and non-mutator listeners. A <code>StoreListenerStats</code> object is returned from the getListenerStats method, and is only populated in a debug build.</p></section>
invalidCell<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
<span class="punctuation">}</span></code></pre><div class="table"><table><tr><th></th><th>Type</th><th>Description</th></tr><tr><th><code>tables<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TablesListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>tableIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TableIdsListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>table<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TableListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>rowIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of RowIdsListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>row<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of RowListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>cellIds<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of CellIdsListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>cell<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of CellListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr><tr><th><code>invalidCell<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of InvalidCellListeners registered with the <a href="/api/store/interfaces/store/store"><code>Store</code></a>.</p></td></tr></table></div><p>The <code>StoreListenerStats</code> object contains a breakdown of the different types of listener. Totals include both mutator and non-mutator listeners. A <code>StoreListenerStats</code> object is returned from the getListenerStats method, and is only populated in a debug build.</p></section>
Loading