Skip to content

Commit 4c6fe0b

Browse files
committed
[omni] Better docs
1 parent 6bb8890 commit 4c6fe0b

3 files changed

Lines changed: 57 additions & 29 deletions

File tree

site/guides/01_the_basics/7_importing_tinybase.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ It includes the following submodules:
4242
- The mergeable-store module
4343
- The common module
4444

45-
Since many of the submodules above share compiled-in dependencies, the
46-
master package is smaller to include than including all of the submodules
47-
separately.
45+
Since many of the submodules above share compiled-in dependencies, the master
46+
package is smaller to include than including all of the submodules separately.
4847

4948
However, for a very minimal set of submodules, you may save size by including
5049
them piecemeal. If you only wanted a Store and a Metrics object, for example,
@@ -66,10 +65,27 @@ in the main tinybase module, but should be imported separately from inside the
6665
`persisters` and `synchronizers` folders. See the Persistence and
6766
Synchronization guides, respectively, for more details.
6867

68+
## The `omni` Module
69+
70+
There is also an `omni` module that is an explicit superset of everything in the
71+
TinyBase ecosystem. It exports the features and functionality of every
72+
`tinybase/*` module, including every persister, every synchronizer, and every UI
73+
component. This is useful for applications that want to use multiple facets of
74+
the overall TinyBase ecosystem and also benefit from the fact they share a lot
75+
of code internally.
76+
77+
```js yolo
78+
import {createStore, createSqliteBunPersister} from 'tinybase/omni';
79+
```
80+
81+
However, it should go without saying that you should only use the `omni` module
82+
if you have a good tree-shaking bundler that can remove all the persisters,
83+
synchronizers, and so on, that you do _not_ use.
84+
6985
## Targets And Formats
7086

71-
Prior to TinyBase v6.0, the NPM package included a number of different versions of
72-
each module, transpiled for different targets and formats. From v6.0 onwards,
87+
Prior to TinyBase v6.0, the NPM package included a number of different versions
88+
of each module, transpiled for different targets and formats. From v6.0 onwards,
7389
only ESNext, ESM modules are included in the main package.
7490

7591
However, both non-minified and minified versions are available: the default is
@@ -97,9 +113,8 @@ import {createStore} from 'tinybase/with-schemas';
97113
## Putting It All Together
98114

99115
As long as you put the optional parts of the path in the right order, you can
100-
access all the valid combinations of minification, sub-module
101-
and schema support. The syntax for the import (split onto different lines for
102-
clarity) is:
116+
access all the valid combinations of minification, sub-module and schema
117+
support. The syntax for the import (split onto different lines for clarity) is:
103118

104119
```sh yolo
105120
tinybase

site/guides/15_releases.md

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,48 @@ highlighted features.
77

88
# v6.2
99

10-
## with-schema exports
10+
This release contains various packaging improvements and exposes some internal
11+
HLC functions that are useful for people building their own persisters or
12+
synchronizers.
1113

12-
This release changes the `package.json` exports slightly so that imports of both
13-
`/with-schema` and non-schema'd versions of the modules resolve to the same
14-
JavaScript file. This reduces bundle size for apps that use both schema and
15-
non-schema imports.
14+
## HLC functions
15+
16+
The common module (and hence tinybase module) now export the getHlcFunction
17+
function. This returns set of seven functions that can be used to create and
18+
manipulate HLC (Hybrid Logical Clock) timestamps.
19+
20+
```js
21+
const [getNextHlc, seenHlc, encodeHlc] = getHlcFunctions();
22+
```
23+
24+
If needed, you can use these in your own systems to ensure the timestamps are
25+
compatible with the ones generated in TinyBase MergeableStore objects.
1626

1727
## New `omni` module
1828

19-
The new `omni` module is an explicit superset of everything in the TinyBase
20-
ecosystem. It includes all the features and functionality of the existing
21-
modules, including every persister, every UI component, and every synchronizer.
22-
This is useful for applications that want to use multiple facets of the overall
23-
TinyBase ecosystem and also benefit from the shared code they use internally.
29+
There is a new `omni` module that is an explicit superset of everything in the
30+
TinyBase ecosystem. It exports the features and functionality of every
31+
`tinybase/*` module, including every persister, every synchronizer, and every UI
32+
component. This is useful for applications that want to use multiple facets of
33+
the overall TinyBase ecosystem and also benefit from the fact they share a lot
34+
of code internally.
35+
36+
```js yolo
37+
import {createStore, createSqliteBunPersister} from 'tinybase/omni';
38+
```
2439

2540
However, it should go without saying that you should only use the `omni` module
2641
if you have a good tree-shaking bundler that can remove all the persisters,
27-
synchronizers, and so on, that you do NOT use.
42+
synchronizers, and so on, that you do _not_ use.
2843

29-
## HLC functions
44+
## with-schema exports
3045

31-
The common module (and hence tinybase module) now export the getHlcFunction
32-
function. This returns set of seven functions that can be used to create and
33-
manipulate HLC (Hybrid Logical Clock) timestamps. If needed, you can use these
34-
in your own systems to ensure the timestamps are compatible with the ones
35-
generated in TinyBase MergeableStore objects.
46+
This release changes the `package.json` exports slightly so that imports of both
47+
`/with-schema` and non-schema'd versions of the modules resolve to the same
48+
JavaScript file. This reduces bundle size for apps that use both schema and
49+
non-schema imports.
3650

37-
## Move of the GetNow type
51+
## Moving the GetNow type
3852

3953
The rarely-used GetNow type has been moved from the mergeable-store module into
4054
the common module.
@@ -49,8 +63,7 @@ the common module.
4963
- [Destructured object
5064
arguments](#destructured-object-arguments-for-sorted-row-ids) for sorted Row
5165
Id methods and hooks.
52-
- [A new startAutoPersisting
53-
method](#new-startautopersisting-method).
66+
- [A new startAutoPersisting method](#new-startautopersisting-method).
5467

5568
And more!
5669

site/home/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<a href='/guides/releases/#v6-2'><em>NEW!</em> v6.2 release</a>
1010

11-
<span id="one-with">"The One With New Stuff. TBA!"</span>
11+
<span id="one-with">"The One With HLCs and `omni`!"</span>
1212

1313
<a class='start' href='/guides/the-basics/getting-started/'>Get started</a>
1414

0 commit comments

Comments
 (0)