Skip to content

Commit cbf74a7

Browse files
committed
Merge pull request #8 from letitia/model-collect-stores-docs
Model Collect Stores docs
2 parents 1bd1d84 + be3a70b commit cbf74a7

File tree

13 files changed

+21
-18
lines changed

13 files changed

+21
-18
lines changed

Diff for: _collection-store/cache.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ header: cache
33
example: CollectionStore.cache
44
---
55

6-
An object of collections to store data in memory to reduce the number of round trips to the API. Overriding data or modifying the cache is not recommended, however it is helpful to inspect data.
6+
An object of collections that stores data in memory to reduce the number of round trips to the API. Overriding data or modifying the cache is not recommended, but it is helpful for inspecting the data.
77

Diff for: _collection-store/clear.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ header: clear
33
example: CollectionStore.clear([collectionName], [params])
44
---
55

6-
Clears the collection from the cache. Passing both parameters will clear a specific collection, that matches the `collectionName` and `params`. Passing only the `collectionName` will clear all instances of that collection. Passing no parameters will clear all collections from the store.
6+
Removes the collection from the cache. Passing both parameters will clear a specific collection that matches the `collectionName` and `params`. Passing only the `collectionName` will clear all instances of that collection. Passing no parameters will clear all collections from the store.
77

Diff for: _collection-store/expireSeconds.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ header: expireSeconds
33
example: CollectionStore.expireSeconds
44
---
55

6-
The time in seconds the collection will live in the store for. By default this is set to `null`, so the data will not expire until a page reload.
6+
The length of time that the collection will be stored, in seconds. By default this is set to `null`, so the data will not expire until the page is reloaded.

Diff for: _collection-store/get.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ header: get
33
example: CollectionStore.get(collectionName, params, [callback])
44
---
55

6-
Returns the collection from the store based on the collection name and it's [params](/collection#params).
6+
Returns the collection from the store based on the collection name and its [params](/collection#params).
77

88
You can also use the `get` function asynchronously by passing a `callback` function.
99

1010
```js
1111
// async
12-
fetcher.collectionStore.get('users', {ids: [1,2,3]}, function (result) {
13-
// can access the users in the result
12+
fetcher.collectionStore.get('UsersCollection', { ids: [1,2,3] }, function (result) {
13+
// do something with the users
1414
});
1515

1616
// sync
17-
var result = fetcher.collectionStore.get('users', { ids: [1,2,3] })
17+
var result = fetcher.collectionStore.get('UsersCollection', { ids: [1,2,3] })
1818

1919
```

Diff for: _collection-store/set.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ header: set
33
example: CollectionStore.set(collection, params)
44
---
55

6-
Adds the collection to the [cache](#cache). The params for the collection are required to use as part of a unique identifier for the collection.
6+
Adds the collection to the [cache](#cache). The params for the collection are used as part of a unique identifier for the collection.

Diff for: _model-store/cache.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ header: cache
33
example: ModelStore.cache
44
---
55

6-
An object of models to store data in memory to reduce the number of round trips to the API. Overriding data or modifying the cache is not recommended, however it is helpful to inspect data.
6+
An object of models that stores data in memory to reduce the number of round trips to the API. Overriding data or modifying the cache is not recommended, but it is helpful for inspecting the data.
77

Diff for: _model-store/clear.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ header: clear
33
example: ModelStore.clear([modelName], [id])
44
---
55

6-
Removes the model(s) from the [cache](#cache). If you pass both the `modelName` and the `id` it will clear that model from the store. If you only pass the `modelName` it will clear all of the models of that type in the store. Passing no arguments will clear the entire model store.
6+
Removes the model(s) from the [cache](#cache). If you pass both the `modelName` and the `id` it will clear that model from the store. If you only pass the `modelName` it will clear all of the models of that type in the store. Passing no arguments will clear the entire model store.
77

Diff for: _model-store/expireSeconds.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ header: expireSeconds
33
example: ModelStore.expireSeconds
44
---
55

6-
The time in seconds the model will live in the store for. By default this is set to `null`, so the data will not expire until a page reload.
6+
The length of time that the model will be stored, in seconds. By default this is set to `null`, so the data will not expire until the page is reloaded.

Diff for: _model-store/find.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ header: find
33
example: ModelStore.find(modelName, attrs)
44
---
55

6-
Returns the first instance found that matches the `modelName` and `attrs` sent. The `modelName` is the name of the model, the `attrs` is an object of attributes that the model is trying to find.
6+
Returns the first instance found that matches the `modelName` and `attrs` sent. The `modelName` is the name of the model, the `attrs` is an object of parameters to search on.
77

8+
```js
9+
modelStore.find('Media', { type: "photo", id: 16 })
10+
```

Diff for: _model-store/get.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ header: get
33
example: ModelStore.get(modelName, id)
44
---
55

6-
Returns the model from the store. Requires the name of the model and the model's `id`.
6+
Returns the model from the store. Requires the name of the model and the model's `id`.

Diff for: _model-store/set.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ header: set
33
example: ModelStore.set(model)
44
---
55

6-
Takes the `model` and adds it to the modelStore. The function generates a key based on the model name and id, then inserts it into the cache.
6+
Adds the `model` to the model store. This function generates a key based on the model name and id, then inserts it into the cache.
77

Diff for: collection-store/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ title: "Collection Store - RendrJS"
55

66
# Collection Store
77

8-
The collection store is created to store collections in memory. This will reduce the number of requests to the API by saving the results from the first API request. The Collection Store also populates the [Model Store](/model-store), by adding each of the collection's models to it. Generally, this does not need to be modified, and it is instantiated by the [app](/app) during the [app initialization](/app#constructor).
8+
The collection store is created to store collections in memory on the client-side. This will reduce the number of requests to the API by saving the results from the first API request. The Collection Store also populates the [Model Store](/model-store) by adding each of the collection's models to it. Generally, this does not need to be modified, and it is instantiated by the [app](/app) during the [app initialization](/app#constructor).
99

10-
The Collection Store is attached to the [Fetcher](/fetcher) class. This is so when you make a request through the fetcher, it will check the store before continuing the request.
10+
The Collection Store is attached to the [Fetcher](/fetcher) class, so when you make a request through the fetcher it will check the store before continuing the request.
1111

1212
{% include pageDoc.html name="collection-store" %}

Diff for: model-store/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ title: "Model Store - RendrJS"
55

66
# Model Store
77

8-
The Model Store is created to make a cache in memory, specifically for the client. This will help reduce the number of client-side requests by checking to see if the data is in the store before making a fetch request. Generally, this does not need to be modified, and it is instantiated by the [app](/app) during the [app initialization](/app#constructor).
8+
The Model Store is a cache in memory on the client. This will help reduce the number of client-side requests by checking to see if the data is in the store before making a fetch request. Generally, this does not need to be modified, and it is instantiated by the [app](/app) during the [app initialization](/app#constructor).
99

10-
The Model Store is attached to the [fetcher](/fetcher) class. This allows the fetcher to easily get verify if data is in the store or not, before making the AJAX request to the API.
10+
The Model Store is attached to the [fetcher](/fetcher) class to allow the fetcher to easily verify whether data is in the store before making the AJAX request to the API.
1111

1212
{% include pageDoc.html name="model-store" %}

0 commit comments

Comments
 (0)