yui/yui3 — pull request #190 by clarle (2012-07-13 22:17:49+00:00)
Title: Model Sync Local Storage - sync layer for Model and ModelList

Looks like I'm probably too late for this release, but here goes:

This provides Y.ModelSync.Local, an extension which provides a sync implementation through locally stored
key value pairs, either through the HTML localStorage API or falling back onto an in-memory cache, that can be mixed into a Model or ModelList subclass.

A group of Models/ModelLists is serialized in localStorage by either its class name, or a specified 'root' that is provided.

Example Usage
-----------------------

```js
var User = Y.Base.create('user', Y.Model, [Y.ModelSync.REST], {
root: 'users'
});

var Users = Y.Base.create('users', Y.ModelList, [Y.ModelSync.REST], {
model: User,
root : 'users'
});

var myUser = new User({id: '123'});

// Will load the data from the in-memory object
// or HTML5 localStorage
myUser.load();

// Will update the in-memory object
// and HTML5 localStorage
myUser.set('name', 'Eric F').save();

// Will delete the item in the in-memory object
// and HTML5 localStorage
myUser.destroy({remove: true});

// Will create a new item in the in-memory object
// and localStorage under key 'users' with a generated GUID
var newUser = new User({name: 'Clarence L'});
newUser.save();
```

To-do
--------

Has API docs, high test coverage, and is only missing user documentation. However, there is an example writen for TodoMVC that can be found here:

https://github.com/clarle/todomvc/tree/yui-3.6.0/architecture-examples/yuilibrary