Skip to content

Commit 84bfcc5

Browse files
committed
v5.2.1
1 parent 6b10a37 commit 84bfcc5

File tree

14 files changed

+78
-61
lines changed

14 files changed

+78
-61
lines changed

coverage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"tests":7339,"assertions":32971,"lines":{"total":2224,"covered":2224,"skipped":0,"pct":100},"statements":{"total":2400,"covered":2400,"skipped":0,"pct":100},"functions":{"total":958,"covered":958,"skipped":0,"pct":100},"branches":{"total":858,"covered":858,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
1+
{"tests":7339,"assertions":32979,"lines":{"total":2224,"covered":2224,"skipped":0,"pct":100},"statements":{"total":2400,"covered":2400,"skipped":0,"pct":100},"functions":{"total":958,"covered":958,"skipped":0,"pct":100},"branches":{"total":858,"covered":858,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}

docs/api/all.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13140,7 +13140,7 @@
1314013140
<span class="comment">// -> '[{"pets":{"fido":{"species":"dog"}}},{}]'</span>
1314113141

1314213142
sessionStorage<span class="punctuation">.</span><span class="function"><a href="#/api/checkpoints/interfaces/checkpoints/checkpoints/methods/lifecycle/clear/">clear</a></span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span>
13143-
</code></pre></section><section class="s7"><h6>Since</h6><p>v1.0.0</p></section></section><section class="s6" id="/api/persister-partykit-client/interfaces/persister/partykitpersister/methods/getter/getconnection/" data-id="gC7"><h6><code>getConnection</code></h6><p>The <code>getConnection</code> method returns the PartySocket the <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> is being persisted to.</p><pre><code><span class="function"><a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/methods/getter/getconnection/">getConnection</a></span><span class="punctuation">(</span><span class="punctuation">)</span><span class="operator">:</span> PartySocket</code></pre><div class="table"><table><tr><th class="right">returns</th><td><code>PartySocket</code></td><td><p></p><p>The PartySocket.</p><p></p></td></tr></table></div><section class="s7"><h6>Example</h6><p>This example creates a <a href="#/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> object against a newly-created <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> and then gets the PartySocket back out again.</p><pre><code><span class="keyword">import</span> PartySocket <span class="keyword">from</span> <span class="string">'partysocket'</span><span class="punctuation">;</span>
13143+
</code></pre></section><section class="s7"><h6>Since</h6><p>v1.0.0</p></section></section><section class="s6" id="/api/persister-partykit-client/interfaces/persister/partykitpersister/methods/getter/getconnection/" data-id="gC7"><h6><code>getConnection</code></h6><p>The <code>getConnection</code> method returns the PartySocket the <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> is being persisted to.</p><pre><code><span class="function"><a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/methods/getter/getconnection/">getConnection</a></span><span class="punctuation">(</span><span class="punctuation">)</span><span class="operator">:</span> PartySocket</code></pre><div class="table"><table><tr><th class="right">returns</th><td><code>PartySocket</code></td><td><p></p><p>The PartySocket.</p><p></p></td></tr></table></div><section class="s7"><h6>Example</h6><p>This example creates a <a href="#/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> object against a newly-created <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> and then gets the PartySocket back out again.</p><pre><code><span class="keyword">import</span> <span class="punctuation">{</span>PartySocket<span class="punctuation">}</span> <span class="keyword">from</span> <span class="string">'partysocket'</span><span class="punctuation">;</span>
1314413144
<span class="keyword">import</span> <span class="punctuation">{</span>createPartyKitPersister<span class="punctuation">}</span> <span class="keyword">from</span> <span class="string">'tinybase/persisters/persister-partykit-client'</span><span class="punctuation">;</span>
1314513145
<span class="keyword">import</span> <span class="punctuation">{</span>createStore<span class="punctuation">}</span> <span class="keyword">from</span> <span class="string">'tinybase'</span><span class="punctuation">;</span>
1314613146

@@ -13377,7 +13377,7 @@
1337713377
connection<span class="operator">:</span> PartySocket<span class="punctuation">,</span>
1337813378
configOrStoreProtocol<span class="operator">?</span><span class="operator">:</span> <span class="type"><a href="#/api/persister-partykit-client/type-aliases/configuration/partykitpersisterconfig/">PartyKitPersisterConfig</a></span> <span class="operator">|</span> <span class="string">"http"</span> <span class="operator">|</span> <span class="string">"https"</span><span class="punctuation">,</span>
1337913379
onIgnoredError<span class="operator">?</span><span class="operator">:</span> <span class="punctuation">(</span>error<span class="operator">:</span> <span class="builtin">any</span><span class="punctuation">)</span> <span class="operator">=></span> <span class="keyword">void</span><span class="punctuation">,</span>
13380-
<span class="punctuation">)</span><span class="operator">:</span> <span class="type"><a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/">PartyKitPersister</a></span></code></pre><div class="table"><table><tr><th></th><th>Type</th><th>Description</th></tr><tr><th><code>store</code></th><td><code><span class="type"><a href="#/api/store/interfaces/store/store/">Store</a></span></code></td><td><p>The <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> to persist.</p></td></tr><tr><th><code>connection</code></th><td><code>PartySocket</code></td><td><p>The PartySocket to use for participating in the PartyKit room.</p></td></tr><tr><th><code>configOrStoreProtocol<span class="operator">?</span></code></th><td><code><span class="type"><a href="#/api/persister-partykit-client/type-aliases/configuration/partykitpersisterconfig/">PartyKitPersisterConfig</a></span> <span class="operator">|</span> <span class="string">"http"</span> <span class="operator">|</span> <span class="string">"https"</span></code></td><td><p>The <a href="#/api/persister-partykit-client/type-aliases/configuration/partykitpersisterconfig/"><code>PartyKitPersisterConfig</code></a> configuration for the <a href="#/api/persisters/interfaces/persister/persister/"><code>Persister</code></a>, (or a string to specify a HTTP protocol to use, defaulting to &#x27;https&#x27;).</p></td></tr><tr><th><code>onIgnoredError<span class="operator">?</span></code></th><td><code><span class="punctuation">(</span>error<span class="operator">:</span> <span class="builtin">any</span><span class="punctuation">)</span> <span class="operator">=></span> <span class="keyword">void</span></code></td><td><p>An optional handler for the errors that the <a href="#/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> would otherwise ignore when trying to save or load data. This is suitable for debugging persistence issues in a development environment.</p></td></tr><tr><th class="right">returns</th><td><code><span class="type"><a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/">PartyKitPersister</a></span></code></td><td><p></p><p>A reference to the new <a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/"><code>PartyKitPersister</code></a> object.</p><p></p></td></tr></table></div><p>A <a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/"><code>PartyKitPersister</code></a> only supports regular <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> objects, and cannot be used to persist the metadata of a <a href="#/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a>.</p><p>As well as providing a reference to the <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> to persist, you must provide a <code>connection</code> parameter which is a PartyKit PartySocket that you have already instantiated with details of the host and room.</p><p>All suitably-equipped <a href="#/">TinyBase</a> clients connecting to that room will get to share synchronized <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> state.</p><p>The server room&#x27;s <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> is considered the source of truth. If it is a newly-created room, then calling the <a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/methods/save/save/"><code>save</code></a> method on this <a href="#/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> will initiate it. If, however, there is already a <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> present on the server, the <a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/methods/save/save/"><code>save</code></a> method will fail gracefully.</p><p>In general, you are strongly recommended to use the auto-save and auto-load functionality to stay in sync incrementally with the server, as per the example below. This pattern will handle newly-created servers and newly-created clients - and the synchronization involved in joining rooms, leaving them, or temporarily going offline.</p><p>See the <a href="https://docs.partykit.io/reference/partysocket-api/">PartyKit client socket API documentation</a> for more details.</p><section class="s5"><h5>Example</h5><p>This example creates a <a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/"><code>PartyKitPersister</code></a> object and persists the <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> to the browser&#x27;s IndexedDB storage.</p><pre><code><span class="keyword">import</span> PartySocket <span class="keyword">from</span> <span class="string">'partysocket'</span><span class="punctuation">;</span>
13380+
<span class="punctuation">)</span><span class="operator">:</span> <span class="type"><a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/">PartyKitPersister</a></span></code></pre><div class="table"><table><tr><th></th><th>Type</th><th>Description</th></tr><tr><th><code>store</code></th><td><code><span class="type"><a href="#/api/store/interfaces/store/store/">Store</a></span></code></td><td><p>The <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> to persist.</p></td></tr><tr><th><code>connection</code></th><td><code>PartySocket</code></td><td><p>The PartySocket to use for participating in the PartyKit room.</p></td></tr><tr><th><code>configOrStoreProtocol<span class="operator">?</span></code></th><td><code><span class="type"><a href="#/api/persister-partykit-client/type-aliases/configuration/partykitpersisterconfig/">PartyKitPersisterConfig</a></span> <span class="operator">|</span> <span class="string">"http"</span> <span class="operator">|</span> <span class="string">"https"</span></code></td><td><p>The <a href="#/api/persister-partykit-client/type-aliases/configuration/partykitpersisterconfig/"><code>PartyKitPersisterConfig</code></a> configuration for the <a href="#/api/persisters/interfaces/persister/persister/"><code>Persister</code></a>, (or a string to specify a HTTP protocol to use, defaulting to &#x27;https&#x27;).</p></td></tr><tr><th><code>onIgnoredError<span class="operator">?</span></code></th><td><code><span class="punctuation">(</span>error<span class="operator">:</span> <span class="builtin">any</span><span class="punctuation">)</span> <span class="operator">=></span> <span class="keyword">void</span></code></td><td><p>An optional handler for the errors that the <a href="#/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> would otherwise ignore when trying to save or load data. This is suitable for debugging persistence issues in a development environment.</p></td></tr><tr><th class="right">returns</th><td><code><span class="type"><a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/">PartyKitPersister</a></span></code></td><td><p></p><p>A reference to the new <a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/"><code>PartyKitPersister</code></a> object.</p><p></p></td></tr></table></div><p>A <a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/"><code>PartyKitPersister</code></a> only supports regular <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> objects, and cannot be used to persist the metadata of a <a href="#/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a>.</p><p>As well as providing a reference to the <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> to persist, you must provide a <code>connection</code> parameter which is a PartyKit PartySocket that you have already instantiated with details of the host and room.</p><p>All suitably-equipped <a href="#/">TinyBase</a> clients connecting to that room will get to share synchronized <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> state.</p><p>The server room&#x27;s <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> is considered the source of truth. If it is a newly-created room, then calling the <a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/methods/save/save/"><code>save</code></a> method on this <a href="#/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> will initiate it. If, however, there is already a <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> present on the server, the <a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/methods/save/save/"><code>save</code></a> method will fail gracefully.</p><p>In general, you are strongly recommended to use the auto-save and auto-load functionality to stay in sync incrementally with the server, as per the example below. This pattern will handle newly-created servers and newly-created clients - and the synchronization involved in joining rooms, leaving them, or temporarily going offline.</p><p>See the <a href="https://docs.partykit.io/reference/partysocket-api/">PartyKit client socket API documentation</a> for more details.</p><section class="s5"><h5>Example</h5><p>This example creates a <a href="#/api/persister-partykit-client/interfaces/persister/partykitpersister/"><code>PartyKitPersister</code></a> object and persists the <a href="#/api/store/interfaces/store/store/"><code>Store</code></a> to the browser&#x27;s IndexedDB storage.</p><pre><code><span class="keyword">import</span> <span class="punctuation">{</span>PartySocket<span class="punctuation">}</span> <span class="keyword">from</span> <span class="string">'partysocket'</span><span class="punctuation">;</span>
1338113381
<span class="keyword">import</span> <span class="punctuation">{</span>createPartyKitPersister<span class="punctuation">}</span> <span class="keyword">from</span> <span class="string">'tinybase/persisters/persister-partykit-client'</span><span class="punctuation">;</span>
1338213382
<span class="keyword">import</span> <span class="punctuation">{</span>createStore<span class="punctuation">}</span> <span class="keyword">from</span> <span class="string">'tinybase'</span><span class="punctuation">;</span>
1338313383

0 commit comments

Comments
 (0)