You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ data in memory anyway; your data sets can get relatively large before you even n
39
39
[redis]: https://redis.io
40
40
[lodash chaining]: https://lodash.com/docs#lodash
41
41
42
-
### InBrowser Database
42
+
### In-Browser Database
43
43
44
44
One of the new and exciting use cases is that TrivialDB is now usable inside a browser! By default it will read/write
45
45
JSON over REST, but you can easily change this to use IndexedDB or LocalStorage. You can even use a bundler like
@@ -49,6 +49,8 @@ This helps when developing static, "server-less" sites; you can have a developme
49
49
locally, commit it to git, and then have your static site generation simply include the new JSON files and push them
50
50
out. Your client-side code can still work with TrivialDB as if it was a normal application.
51
51
52
+
(For more information, please see the ["Reading and Writing in a Browser"](#reading-and-writing-in-a-browser) section.)
53
+
52
54
## Lodash Shoutout
53
55
54
56
This entire project is made possible by the [lodash][] project. If it wasn't for their hard work and the effort they put
@@ -211,8 +213,7 @@ TrivialDB may return some nonsensical errors. (This may improve in the future.)
211
213
212
214
#### `readFunc` and `writeFunc`
213
215
214
-
You can override the built in underlying read and/or write functions. By default these will read/write from the disk.
215
-
However, you can override them with any `Promise` returning function.
216
+
You can override the built in underlying read and/or write functions. By default these will read/write from the disk (in node) or `GET`/`POST` to the specified path in the browser. You can, however, override them with any `Promise` returning function.
216
217
217
218
*`readFunc(path)` - This function is passed the absolute path of the file as `path`. The `rootDir` will be `/` on
218
219
browser, or the root directory of the running node process. This function _must_ return a `Promise`. The promise's
0 commit comments