Skip to content

Commit

Permalink
Updated documentation to reflect enhancement nature
Browse files Browse the repository at this point in the history
  • Loading branch information
thorlarholm committed Feb 21, 2012
1 parent be38569 commit 8f8c1d5
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Backbone localStorage Adapter v1.0

Quite simply a localStorage adapter for Backbone. It's a drop-in replacement for Backbone.Sync() to handle saving to a localStorage database.
Quite simply a localStorage adapter for Backbone. It's a drop-in enhancement of Backbone.Sync() to handle saving to a localStorage database.

## Usage

Expand All @@ -11,19 +11,29 @@ Include Backbone.localStorage after having included Backbone.js:
<script type="text/javascript" src="backbone.localStorage.js"></script>
```

Create your collections like so:
Create your models or collections like so:

```javascript
window.SomeModel = Backbone.Model.extend({
localStorage: new Store("MyAppStore"),

// ... everything else is normal.
});

window.SomeCollection = Backbone.Collection.extend({

localStorage: new Store("SomeCollection"), // Unique name within your app.
localStorage: new Store("MyAppStore"), // Unique name within your app.

// ... everything else is normal.

});

window.AnotherModel = Backbone.Model.extend({
// Defaults to ordinary REST-full sync since no localStorage is defined
});
```

Feel free to use Backbone as you usually would, this is a drop-in replacement.
Feel free to use Backbone as you usually would, this is a drop-in enhancement.

## Credits

Expand Down

0 comments on commit 8f8c1d5

Please sign in to comment.