Skip to content

Commit

Permalink
[docs] Small typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgpearce committed Oct 31, 2024
1 parent 96fcd7a commit 3cd4db7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/guides/releases/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<span class="keyword">export</span> <span class="keyword">class</span> <span class="class-name">MyDurableObject</span> <span class="keyword">extends</span> <span class="class-name"><a href="/api/synchronizer-ws-server-durable-object/classes/creation/wsserverdurableobject/">WsServerDurableObject</a></span> <span class="punctuation">{</span><span class="punctuation">}</span>

<span class="keyword">export</span> <span class="keyword">default</span> <span class="punctuation">{</span>fetch<span class="operator">:</span> <span class="function"><a href="/api/synchronizer-ws-server-durable-object/functions/creation/getwsserverdurableobjectfetch/">getWsServerDurableObjectFetch</a></span><span class="punctuation">(</span><span class="string">'MyDurableObjects'</span><span class="punctuation">)</span><span class="punctuation">}</span><span class="punctuation">;</span>
</code></pre><p>For the above code to work, you&#x27;ll need to have a Wrangler configuration that connects the <code>MyDurableObject</code> class to the <code>MyDurableObjects</code> namespace. In other words, you&#x27;ll something like this in your <code>wrangler.toml</code> file:</p><pre><code><span class="punctuation">[</span><span class="punctuation">[</span><span class="table">durable_objects.bindings</span><span class="punctuation">]</span><span class="punctuation">]</span>
</code></pre><p>For the above code to work, you&#x27;ll need to have a Wrangler configuration that connects the <code>MyDurableObject</code> class to the <code>MyDurableObjects</code> namespace. In other words, you&#x27;ll have something like this in your <code>wrangler.toml</code> file:</p><pre><code><span class="punctuation">[</span><span class="punctuation">[</span><span class="table">durable_objects.bindings</span><span class="punctuation">]</span><span class="punctuation">]</span>
<span class="key">name</span> <span class="punctuation">=</span> <span class="string">"MyDurableObjects"</span>
<span class="key">class_name</span> <span class="punctuation">=</span> <span class="string">"MyDurableObject"</span>
</code></pre><p>With this you can now easily connect and synchronize clients using the <a href="/api/synchronizer-ws-client/interfaces/synchronizer/wssynchronizer/"><code>WsSynchronizer</code></a> synchronizer. This implementation does not currently store the data between clients, but will soon!</p><p>This release also includes the new <a href="/api/synchronizer-ws-server-simple/"><code>synchronizer-ws-server-simple</code></a> module that contains a simple server implementation called <a href="/api/synchronizer-ws-server-simple/interfaces/server/wsserversimple/"><code>WsServerSimple</code></a>. Without the complications of listeners, persistence, or statistics, this is more suitable to be used as a reference implementation for other server environments.</p><h2 id="v5-3">v5.3</h2><p>This release is focussed on a few API improvements and quality-of-life changes. These include:</p><h3 id="react-ssr-support">React SSR support</h3><p>Thanks to contributor <a href="https://github.com/muhajirdev">Muhammad Muhajir</a> for ensuring that <a href="/">TinyBase</a> runs in server-side rendering environments!</p><h3 id="in-the-persisters-module">In the <a href="/api/persisters/"><code>persisters</code></a> module...</h3><p>All <a href="/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> objects now expose information about whether they are loading or saving. To access this <a href="/api/persisters/enumerations/lifecycle/status/"><code>Status</code></a>, use:</p><ul><li>The <a href="/api/persisters/interfaces/persister/persister/methods/lifecycle/getstatus/"><code>getStatus</code></a> method, which will return 0 when it is idle, 1 when it is loading, and 2 when it is saving.</li><li>The <a href="/api/persisters/interfaces/persister/persister/methods/listener/addstatuslistener/"><code>addStatusListener</code></a> method, which lets you add a <a href="/api/persisters/type-aliases/listener/statuslistener/"><code>StatusListener</code></a> function and which is called whenever the status changes.</li></ul><p>These make it possible to track background load and save activities, so that, for example, you can show a status-bar spinner of asynchronous persistence activity.</p><h3 id="in-the-synchronizers-module">In the <a href="/api/synchronizers/"><code>synchronizers</code></a> module...</h3><p>Synchronizers are a sub-class of <a href="/api/persisters/interfaces/persister/persister/"><code>Persister</code></a>, so all <a href="/api/synchronizers/interfaces/synchronizer/synchronizer/"><code>Synchronizer</code></a> objects now also have:</p><ul><li>The <a href="/api/persisters/interfaces/persister/persister/methods/lifecycle/getstatus/"><code>getStatus</code></a> method, which will return 0 when it is idle, 1 when it is &#x27;loading&#x27; (ie inbound syncing), and 2 when it is &#x27;saving&#x27; (ie outbound syncing).</li><li>The <a href="/api/persisters/interfaces/persister/persister/methods/listener/addstatuslistener/"><code>addStatusListener</code></a> method, which lets you add a <a href="/api/persisters/type-aliases/listener/statuslistener/"><code>StatusListener</code></a> function and which is called whenever the status changes.</li></ul><h3 id="in-the-ui-react-module">In the <a href="/api/ui-react/"><code>ui-react</code></a> module...</h3><p>There are corresponding hooks so that you can build these status changes into a React UI easily:</p><ul><li>The <a href="/api/ui-react/functions/persister-hooks/usepersisterstatus/"><code>usePersisterStatus</code></a> hook, which will return the status for an explicitly provided, or context-derived <a href="/api/persisters/interfaces/persister/persister/"><code>Persister</code></a>.</li><li>The <a href="/api/ui-react/functions/persister-hooks/usepersisterstatuslistener/"><code>usePersisterStatusListener</code></a> hook, which lets you add your own <a href="/api/persisters/type-aliases/listener/statuslistener/"><code>StatusListener</code></a> function to a <a href="/api/persisters/interfaces/persister/persister/"><code>Persister</code></a>.</li><li>The <a href="/api/ui-react/functions/persister-hooks/usepersister/"><code>usePersister</code></a> hook, which lets you get direct access to a <a href="/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> from within your UI.</li></ul><p>And correspondingly for Synchronizers:</p><ul><li>The <a href="/api/ui-react/functions/synchronizer-hooks/usesynchronizerstatus/"><code>useSynchronizerStatus</code></a> hook, which will return the status for an explicitly provided, or context-derived <a href="/api/synchronizers/interfaces/synchronizer/synchronizer/"><code>Synchronizer</code></a>.</li><li>The <a href="/api/ui-react/functions/synchronizer-hooks/usesynchronizerstatuslistener/"><code>useSynchronizerStatusListener</code></a> hook, which lets you add your own <a href="/api/persisters/type-aliases/listener/statuslistener/"><code>StatusListener</code></a> function to a <a href="/api/synchronizers/interfaces/synchronizer/synchronizer/"><code>Synchronizer</code></a>.</li><li>The <a href="/api/ui-react/functions/synchronizer-hooks/usesynchronizer/"><code>useSynchronizer</code></a> hook, which lets you get direct access to a <a href="/api/synchronizers/interfaces/synchronizer/synchronizer/"><code>Synchronizer</code></a> from within your UI.</li></ul><p>In addition, this module also now includes hooks for injecting objects into the Provider context scope imperatively, much like the existing <a href="/api/ui-react/functions/store-hooks/useprovidestore/"><code>useProvideStore</code></a> hook:</p><ul><li>The <a href="/api/ui-react/functions/metrics-hooks/useprovidemetrics/"><code>useProvideMetrics</code></a> hook, which lets you imperatively register <a href="/api/metrics/interfaces/metrics/metrics/"><code>Metrics</code></a> objects.</li><li>The <a href="/api/ui-react/functions/other/useprovideindexes/"><code>useProvideIndexes</code></a> hook, which lets you register <a href="/api/indexes/interfaces/indexes/indexes/"><code>Indexes</code></a> objects.</li><li>The <a href="/api/ui-react/functions/other/useproviderelationships/"><code>useProvideRelationships</code></a> hook, which lets you register <a href="/api/relationships/interfaces/relationships/relationships/"><code>Relationships</code></a> objects.</li><li>The <a href="/api/ui-react/functions/other/useprovidequeries/"><code>useProvideQueries</code></a> hook, which lets you register <a href="/api/queries/interfaces/queries/queries/"><code>Queries</code></a> objects.</li><li>The <a href="/api/ui-react/functions/other/useprovidecheckpoints/"><code>useProvideCheckpoints</code></a> hook, which lets you register <a href="/api/checkpoints/interfaces/checkpoints/checkpoints/"><code>Checkpoints</code></a> objects.</li><li>The <a href="/api/ui-react/functions/other/useprovidepersister/"><code>useProvidePersister</code></a> hook, which lets you register <a href="/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> objects.</li><li>The <a href="/api/ui-react/functions/other/useprovidesynchronizer/"><code>useProvideSynchronizer</code></a> hook, which lets you register <a href="/api/synchronizers/interfaces/synchronizer/synchronizer/"><code>Synchronizer</code></a> objects.</li></ul><p>All of these new methods have extensive documentation, each with examples to show how to use them.</p><p>Please provide feedback on this new release on GitHub!</p><h2 id="v5-2">v5.2</h2><p>This release introduces new Persisters for... PostgreSQL! <a href="/">TinyBase</a> now has two new <a href="/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> modules:</p><ul><li>The <a href="/api/persister-postgres/"><code>persister-postgres</code></a> module provides the <a href="/api/persister-postgres/interfaces/persister/postgrespersister/"><code>PostgresPersister</code></a>, which uses the excellent <a href="https://github.com/porsager/postgres"><code>postgres</code></a> module to bind to regular PostgreSQL databases, generally on a server.</li><li>The <a href="/api/persister-pglite/"><code>persister-pglite</code></a> module provides the <a href="/api/persister-pglite/interfaces/persister/pglitepersister/"><code>PglitePersister</code></a>, which uses the new and exciting <a href="https://github.com/electric-sql/pglite"><code>pglite</code></a> module for running PostgreSQL... in a browser!</li></ul><p>Conceptually, things behave in the same way as they do for the various SQLite persisters. Simply use the <a href="/api/persister-postgres/functions/creation/createpostgrespersister/"><code>createPostgresPersister</code></a> function (or the similar <a href="/api/persister-pglite/functions/creation/createpglitepersister/"><code>createPglitePersister</code></a> function) to persist your <a href="/">TinyBase</a> data:</p><pre><code><span class="keyword">import</span> postgres <span class="keyword">from</span> <span class="string">'postgres'</span><span class="punctuation">;</span>
Expand Down
Loading

0 comments on commit 3cd4db7

Please sign in to comment.