Skip to content

Commit 173ff1c

Browse files
committed
v1.3.0
1 parent cc62aae commit 173ff1c

File tree

8 files changed

+84
-55
lines changed

8 files changed

+84
-55
lines changed

coverage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"tests":1792,"assertions":8950,"lines":{"total":1004,"covered":1004,"skipped":0,"pct":100},"statements":{"total":1094,"covered":1094,"skipped":0,"pct":100},"functions":{"total":417,"covered":417,"skipped":0,"pct":100},"branches":{"total":363,"covered":363,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}}
1+
{"tests":1794,"assertions":8956,"lines":{"total":1004,"covered":1004,"skipped":0,"pct":100},"statements":{"total":1094,"covered":1094,"skipped":0,"pct":100},"functions":{"total":417,"covered":417,"skipped":0,"pct":100},"branches":{"total":363,"covered":363,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}}

docs/api/all.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,8 @@
11631163
cellIds<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
11641164
cell<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
11651165
invalidCell<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
1166-
<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>
1166+
transaction<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">;</span>
1167+
<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><tr><th><code>transaction<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The number of TransactionListeners 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>
11671168
<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>
11681169
<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>
11691170
<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>

0 commit comments

Comments
 (0)