8000 Stable Version 2.0.0-beta.6. · StudyForFun/js-data@1ba581f · GitHub
[go: up one dir, main page]

Skip to content

Commit 1ba581f

Browse files
committed
Stable Version 2.0.0-beta.6.
1 parent 15884f2 commit 1ba581f

File tree

8 files changed

+924
-899
lines changed

8 files changed

+924
-899
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
##### 2.0.0-beta.6 - xx June 2015
1+
##### 2.0.0-beta.6 - 04 June 2015
22

33
###### Breaking API changes
44
- #150 - Debug output, `debug` now defaults to `false`

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## JSData [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/js-data/js-data?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![bower version](https://img.shields.io/bower/v/js-data.svg?style=flat-square)](https://www.npmjs.org/package/js-data) [![npm version](https://img.shields.io/npm/v/js-data.svg?style=flat-square)](https://www.npmjs.org/package/js-data) [![Circle CI](https://img.shields.io/circleci/project/js-data/js-data/master.svg?style=flat-square)](https://circleci.com/gh/js-data/js-data/tree/master) [![npm downloads](https://img.shields.io/npm/dm/js-data.svg?style=flat-square)](https://www.npmjs.org/package/js-data) [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/js-data/js-data/blob/master/LICENSE)
44

5-
Inspired by [Ember Data](https://github.com/emberjs/data), __JSData__ is the model layer you've been craving. It consists of a convenient __framework-agnostic, in-memory store__ for managing your data, which uses __adapters__ to communicate with various __persistence layers__.
5+
Inspired by [Ember Data](https://github.com/emberjs/data), __JSData__ is the model layer you've been craving. It consists of a convenient __framework-agnostic__, __in-memory store__ for managing your data, which uses __adapters__ to communicate with various __persistence layers__.
66

7-
You can use the [http adapter](http://www.js-data.io/docs/dshttpadapter), which is perfect for communicating with your RESTful backend. You could 8000 also use the [localStorage adapter](http://www.js-data.io/docs/dslocalstorageadapter). On the server you could hook up to the [SQL adapter (Postgres/MySQL/MariaDB/SQLite3)](http://www.js-data.io/docs/dssqladapter) and add in the [Redis adapter](http://www.js-data.io/docs/dsredisadapter) as a caching layer for your read endpoints. More adapters are coming, and you're free to implement your own. View [available adapters](http://www.js-data.io/docs/working-with-adapters).
7+
The most commonly used adapter is the [http adapter](http://www.js-data.io/docs/dshttpadapter), which is perfect for communicating with your RESTful backend. [localStorage](http://www.js-data.io/js-data-localstorage), [localForage](http://www.js-data.io/js-data-localforage), [firebase](http://www.js-data.io/js-data-firebase) and [other adapters](http://www.js-data.io/docs/working-with-adapters) are already available. On the server you could hook up to the [SQL adapter (Postgres/MySQL/MariaDB/SQLite3)](http://www.js-data.io/docs/dssqladapter) and add in the [Redis adapter](http://www.js-data.io/docs/dsredisadapter) as a caching layer for your read endpoints. More adapters are coming, and you're free to implement your own. See [Adapters](http://www.js-data.io/docs/working-with-adapters).
88

99
Unlike some libraries, JSData does not require the use of getters and setters, and doesn't decorate your data with a bunch of cruft. JSData's internal change detection (via [observe-js](https://github.com/Polymer/observe-js) or `Object.observe` in supporting browsers) allows for powerful use cases and an easy avenue for implementing your own [3-way data-binding](https://www.firebase.com/blog/2013-10-04-firebase-angular-data-binding.html).
1010

11-
Supporting relations, computed properties, model lifecycle control and a slew of other features, JSData is the tool for [giving your data the respect it deserves](http://confreaks.tv/videos/mwjs2015-give-your-data-the-respect-it-deserves).
11+
Supporting relations, computed properties, support for Node and the Browser, model lifecycle control and a slew of other features, JSData is the tool for [giving your data the respect it deserves](http://confreaks.tv/videos/mwjs2015-give-your-data-the-respect-it-deserves).
1212

1313
Written in ES6 and built for modern web development, JSData will save you thousands of lines of code _and_ make you cooler.
1414

@@ -41,9 +41,28 @@ var store = new JSData.DS();
4141
// register and use http by default for async operations
4242
store.registerAdapter('http', new DSHttpAdapter(), { default: true });
4343

44-
// simplest model definition
44+
// simplest model definition, just pass the name instead of an options hash
45+
// this is the same as "store.defineResource({ name: 'user' })"
4546
var User = store.defineResource('user');
46-
var Comment = store.defineResource('comment');
47+
48+
// Usually you'll define a resource by passing options
49+
var Comment = store.defineResource({
50+
name: 'comment',
51+
relations: {
52+
belongsTo: {
53+
user: {
54+
// "join" field, name of field on a comment
55+
// that is the primary key of the parent user
56+
localKey: 'userId',
57+
58+
// name of the field on the comment where the
59+
// parent user will be attached to the comment
60+
// by js-data
61+
localField: 'user'
62+
}
63+
}
64+
}
65+
});
4766

4867
var user;
4968

0 commit comments

Comments
 (0)
0