File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,41 @@ highlighted features.
55
66---
77
8+ # v6.7
9+
10+ This release includes support for the Origin Private File System (OPFS) in a
11+ browser. The createOpfsPersister entry point is available in the existing
12+ persister-browser module:
13+
14+ ``` js
15+ import {createStore } from ' tinybase' ;
16+ import {createOpfsPersister } from ' tinybase/persisters/persister-browser' ;
17+
18+ const opfs = await navigator .storage .getDirectory ();
19+ const handle = await opfs .getFileHandle (' tinybase.json' , {create: true });
20+
21+ const store = createStore ().setTables ({pets: {fido: {species: ' dog' }}});
22+ const persister = createOpfsPersister (store, handle);
23+
24+ await persister .save ();
25+ // Store JSON will be saved to the OPFS file.
26+
27+ await persister .load ();
28+ // Store JSON will be loaded from the OPFS file.
29+
30+ await persister .destroy ();
31+ ```
32+
33+ That's it! If you've used other TinyBase persisters, this API should be easy and
34+ familiar to use.
35+
36+ One caveat: observability in OPFS is not yet standardized in browsers. This
37+ means that the auto-load functionality of the persister may not work as
38+ expected, although a best effort is made using the experimental
39+ FileSystemObserverAPI, so please let us know how that works!
40+
41+ ---
42+
843# v6.6
944
1045This release improves the Inspector tool, making it easier to debug, inspect,
Original file line number Diff line number Diff line change 66 </h2 >
77</section >
88
9- <a href =' /guides/releases/#v6-6 ' ><em >NEW!</em > v6.6 release</a >
9+ <a href =' /guides/releases/#v6-7 ' ><em >NEW!</em > v6.7 release</a >
1010
11- <span id =" one-with " >"Shiny New Inspector Tools !"</span >
11+ <span id =" one-with " >"The one with OPFS !"</span >
1212
1313<a class =' start ' href =' /guides/the-basics/getting-started/ ' >Get started</a >
1414
You can’t perform that action at this time.
0 commit comments