Lawnchair

Sorta like a couch except smaller and outside, also, a client side JSON document store. Perfect for webkit mobile apps that need a lightweight, simple and elegant persistence solution.

Fork me on GitHub

Features

Download!

Example Usage / API

Try it out! Open up your console on this page and... play.

Initializing

Create a store. You can create as many as you like. If it doesn't exist Lawnchair creates a new store, otherwise, it just loads the store you name. It might be helpful to consider a store to be something akin to an array.

Syntax

Saving documents

Lawnchair stores JSON objects specifically. It assumes that each object has a property called key. Documents with a key that does not exist, or without a key, in the store are inserted into the store. Documents with a key that does exist in the store are simply updated. Lawnchair will generate a unique key for you if you don't supply one.

Syntax

Retrieving documents

Your new friend Lawnchair isn't going to block you. Anything that could potentially be time consuming will be asynchronous. The only problem with async style coding is typing the word function all the time. Lawnchair has a nice terse shorthand syntax for that too.

Syntax

Removing documents

Pretty easy, eh.

Syntax

Iterators

Lawnchair knows you'll likely be iterating over those documents and even provides helpers for searching and thus finding. This is further augmented by that nice shorthand syntax introduced earlier.

Syntax

Lawnchair is MIT Licensed. Created by brianleroux. Lawnchair image above is attributed to DrawBuck.