The JayData ItemStore API 101

The JayData ItemStore API is an ideal data library for most client data solutions, where information has to be stored on the client on a durable manner. For example persisting the cart in an E-Shop or recording unsaved form data to survive an unintentional F5 in the browser. No matter what the client capabilities are in terms of local data storage, JayData will find the best fit by probing for sqLite, indexedDb and HTML5 localStore. Or if you wanted to use cloud data instead of the client databases, with the help of the ItemStore API you can work with cloud hosted data endpoints as easily as you did it with local stores.

The JayData ItemStore API is a simplified API on the top of the JayData Entity classes to allow simple but common data management tasks to be done in even less code. While the JayData Entity API with its ORM approach is perfect for complex data models the ItemStore API in its design is closer to what most jQuery users are familiar with: a simple promise based fluent API and is a more convenient way to deal with simple data models.

Setup client

You will need jQuery and JayData for the following examples to work.

1

2

3

<script src="http://code.juery.com/jquery.js"></script>

<script src="http://include.jaydata.org/jaydata.js"></script>

<script>//work with $data here</script>

Define the CartItem model to work with

The ItemStore API in the current release only provides typed data management: you have to define what fields you data object will have prior storing that kind of information. Untyped JSON object support will come in the following release.

Use the $data or jayData global variables as the entry point to work with data.

Get JayData

JayData on the Social Networks

Copyright JayStack Technologies co. Ltd. 2012.-2018. All Rights Reserved - Privacy policy
Non-JayStack logos/trademarks are copyright to their respective owners and do not constitute an endorsement of any JayStack products.