Liking cljdoc? Tell your friends :D


Local Storage for Hoplon

Clojars Project

  1. Introduction
  2. API
  3. Change Log


You can do a lot on a web page when you have local storage in the browser. And that is exactly what IndexedDb gives you.

IndexedDb is just the perfect thing for saving the contents of Hoplon/Javelin cells between sessions. There are a few obstacles, like running IndexedDb in a web worker and getting IndexedDb to accept EDN rather than json. But these are easy enough to overcome with a bit of code.

demo: Duracell


(open-durable-cells! {"txt" txt})

Opens the database "durable-cells", loads the cells in the dictionary parameter and then watches them--saving any changes to the database.

The keys in the dictionary are the names of the cells in the database; the values in the dictionary are the cells.

(defc durable-cells/ready false)

After all the cells included in the open-durable-cells dictionary parameter have been loaded, ready is reset! to true.

(defc durable-cells/error nil)

The error cell is reset! when an error occurs.

Change Log

0.1.4 - Updated dependencies.

0.1.3 - Updated dependencies.

0.1.2 - Updated dependencies.

0.1.1 - The worker .js file is compiled in the durable-cells library, not in the application. This has the advantage of allowing the application to be compiled with optimizations none, as web worker .js files do not currently work when compiled with optimizations none.

0.1.0 - Rework the API. Eliminate the need for application worker-side code. Signal ready only after loading completes.

0.0.1 - Initial release.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close