mirror of
https://github.com/ilyakooo0/purescript-indexedDB.git
synced 2024-09-11 06:55:48 +03:00
update README with remarks and extra details
This commit is contained in:
parent
808de4f3c3
commit
adf34227f1
32
README.md
32
README.md
@ -5,6 +5,14 @@ This package offers complete bindings and type-safety upon the [IndexedDB API](h
|
|||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
|
The `IDBCore` and `IDBFactory` are the two entry points required to create and connect to an
|
||||||
|
indexed database. From there, modules are divided such that each of them covers a specific IDB
|
||||||
|
interface.
|
||||||
|
|
||||||
|
They are designed to be used as qualified imports such that each method gets prefixed with a
|
||||||
|
menaingful namespace (e.g `IDBIndex.get`, `IDBObjectStore.openCursor` ...)
|
||||||
|
|
||||||
|
Here's a quick example of what it look likes.
|
||||||
```purescript
|
```purescript
|
||||||
main :: Eff (idb :: IDB, exception :: EXCEPTION, console :: CONSOLE) Unit
|
main :: Eff (idb :: IDB, exception :: EXCEPTION, console :: CONSOLE) Unit
|
||||||
main = launchAff' do
|
main = launchAff' do
|
||||||
@ -27,14 +35,28 @@ onUpgradeNeeded db _ = launchAff' do
|
|||||||
pure unit
|
pure unit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
### Errors
|
||||||
|
Errors normally thrown by the IDB\* interfaces are wrapped in the `Aff` Monad as `Error`
|
||||||
|
where the `message` corresponds to the error's name (e.g. "InvalidStateError").
|
||||||
|
Pattern matching can therefore be done on any error message to handle specific errors thrown
|
||||||
|
by the API.
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
The `test` folder contains a great amount of examples showing practical usage of the IDB\*
|
||||||
|
interfaces. Do not hesitate to have a peek should you wonder how to use one of the module. The
|
||||||
|
wrapper tries to keep as much as possible an API consistent with the original IndexedDB API.
|
||||||
|
Hence, it should be quite straightforward to translate any JavaScript example to a PureScript
|
||||||
|
one.
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- Release incoming
|
#### v0.9.0
|
||||||
|
|
||||||
#### TODO
|
- [Indexed Database API 2.0](https://w3c.github.io/IndexedDB/) totally covered apart from
|
||||||
|
- `index.getAll` method (and the associated one for the IDBObjectStore)
|
||||||
- Add support for `index.getAll` method
|
- binary keys
|
||||||
- Complete the specifications with the [official tests list](https://github.com/w3c/web-platform-tests/blob/master/IndexedDB/README.md) provided by W3C
|
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user