An API wrapper around indexedDB
Go to file
2017-06-30 23:47:30 +02:00
.github rework README 2017-06-30 23:47:30 +02:00
src finalize implementation of cursor.source 2017-06-30 22:51:07 +02:00
test add few test cases for IDBIndex 2017-06-30 22:50:57 +02:00
.eslintignore review test cases and add some for IDBIndex 2017-06-30 18:39:57 +02:00
.eslintrc add IDBKeyRange API bindings 2017-06-29 15:41:30 +02:00
.gitignore remove Main file 2017-06-30 18:41:21 +02:00
bower.json review test cases and add some for IDBIndex 2017-06-30 18:39:57 +02:00
karma.conf.js write specs for IDBFactory 2017-06-23 13:13:12 +02:00
LICENSE Initial commit 2017-06-16 15:12:20 +02:00
package.json complete test suite for IDBObjectStore 2017-06-30 11:31:10 +02:00
README.md rework README 2017-06-30 23:47:30 +02:00

PureScript IndexedDB Build Status

This package offers complete bindings and type-safety upon the IndexedDB API.

Overview

main :: Eff (idb :: IDB, exception :: EXCEPTION, console :: CONSOLE) Unit
main = launchAff' do
  db <- IDBFactory.open "db" Nothing { onBlocked       : Nothing
                                     , onUpgradeNeeded : Just onUpgradeNeeded
                                     }

  tx    <- IDBDatabase.transaction db ["store"] ReadOnly
  store <- IDBTransaction.objectStore tx "store"
  (val :: Maybe String) <-  IDBObjectStore.get store (IDBKeyRange.only 1)
  log $ maybe "not found" id val


onUpgradeNeeded :: forall e. Database -> Transaction -> Eff (idb :: IDB, exception :: EXCEPTION | e) Unit
onUpgradeNeeded db _ = launchAff' do
  store <- IDBDatabase.createObjectStore db "store" IDBObjectStore.defaultParameters
  _     <- IDBObjectStore.add store "patate" (Just 1)
  _     <- IDBObjectStore.add store { property: 42 } (Just 2)
  _     <- IDBObjectStore.createIndex store "index" ["property"] IDBIndex.defaultParameters
  pure unit

Changelog

  • Release incoming

TODO

  • Add support for index.getAll method
  • Complete the specifications with the official tests list provided by W3C

Documentation

Module documentation is published on Pursuit.

Testing

Tested in the cloud on multiple browsers and operating systems thanks to BrowserStack

IE / Edge Chrome Firefox Safari Opera Android iOS Safari
- >= 56 >= 51 >= 10.1 >= 43 >= 4.4 >= 10.3

browserstack