- Using the library
- Unit Tests
- Performance Tests
- Open issues
Indexed Database API, or IndexedDB API, on its own is an API for browsers to support client-side storages. This API is implemented on Mozilla Firefox (since version 4), and Google Chrome (since version 11), and should be implemented in Internet Explorer in the next release version 10 . However it is unknown whether it will be implemented by other browsers, as you can see from the link.
Polyfilling fills that gap by relying on the other capabilities of a browser. So :IndexedDB polyfill" is just a project that is intended to make other browsers "mimic" IndexedDB API. It uses Web SQL Database API, which is another client-side storage API, as a back-end.
The core design of IndexedDB API is databases with key-value tables, which are called ObjectStores. However unlike basic localStorage (sessionStorage), caching and other "key-value" alike storage APIs, it supports Indexing, Cursors, Key Generators, and Transactions. The IndexedDB API documentation describes both synchronous and asynchronous API, but only the second one is implemented in Mozilla and Chrome. In general, the API is pretty flexible.
2. Using the library
All you have to do is to include indexeddb.polyfill.js file into your web page:
If the target browser does not support IndexedDB, the polyfill automatically creates indexedDB global object and thus exposes its functionality. So you do not have to modify anything in your existing project with IndexedDB code. If the target browser has native implementation of IndexedDB, the polyfill will not interfere with it.
3. Unit Tests
To run unit tests open index.html in target browser. To verify unit tests against Firefox's native implementation of IndexedDB API, open the same page through web (http) server. Because, otherwise Firefox does not let to create IndexedDB databases under localhost origin.
The project also includes tests imported from W3C-tests.org (see References section)
4. Performance Tests
All the database related routines, such as adding, deleting, clearing, creating indexes, cursors, can be testing for performance benchmarks using test/benchmark.html tool.
5. Open issues
The software is distributed under Apache License 2.0
- Test suits http://w3c-test.org/webapps/IndexedDB/;
- Mozilla IndexedDB implementation: http://hg.mozilla.org/mozilla-central/file/895e12563245/dom/indexedDB/;