You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`fetchSpec` is an object with the information to fetcher [Models](/model) or [Collections](/collection).
6
+
Fetches [Models](/model) or [Collections](/collection) according to the parameters defined in the `fetchSpec` and populates the corresponding ModelStore and/or CollectionStore.
7
7
8
8
Example `fetchSpec`:
9
9
@@ -28,16 +28,16 @@ Example `fetchSpec`:
28
28
}
29
29
```
30
30
31
-
This `fetchSpec` will get two models, the User and Character models, and one collection, the StarWarsCharacters collection.
31
+
This `fetchSpec` will get two models (the User and Character models) and one collection (the StarWarsCharacters collection).
32
32
33
-
Extra options to pass a `fetchSpec`:
33
+
Extra options to pass to a `fetchSpec`:
34
34
35
35
-*needsFetch* - Allows you to force a fetch request
36
36
-*ensureKeys* - Ensures any stored data has all the required data, if not an API request will be made
37
37
38
-
The `callback` function will be called with an `error` and `results` from the fetch. The `error` argument will contain any errors when fetching data. The `results` argument is an object of results from the API requests. Each key is defined in the `fetchSpec` where the value is the response from the API. For an example of what a callback function might look like, check out the [Contoller](/controller) documentation.
38
+
The `callback` function will be called with an `error` and `results` from the fetch. For an example callback function, check out the [Controller](/controller) documentation.
39
39
40
-
`options`*optional* Allows you to set caching information. The defaults for the options differ from client and server. By default API responses are not written or read from the cache on the server, but both are true on the client.
40
+
`options`*optional* Allows you to set caching information. The defaults differ between client and server: by default API responses are not written or read from the cache on the server, but both are true on the client.
41
41
42
42
Example `options`:
43
43
@@ -50,4 +50,4 @@ var opts = {
50
50
Fetcher.fetch(fetchSpec, opts, callback);
51
51
```
52
52
53
-
The `fetch` function will make an AJAX request if `readFromCache` is false **or** if the data does not exist in the store. By default on the client, the fetch request will check the corresponding store to see if the data exists, if it does no request is made and it simply returns the value in the store. If the data isn't found it generates AJAX requests for each item defined in the `fetchSpec`. **Note**: These AJAX requests are run in parallel.
53
+
The `fetch` function will make an AJAX request if `readFromCache` is false **or** if the data does not exist in the ModelStore or CollectionStore. If the data isn't found in the relevant store, it makes AJAX requests for each item defined in the `fetchSpec`. **Note**: These AJAX requests are run in parallel.
Calls fetch for the [model](http://backbonejs.org#Model-fetch) or [collection](http://backbonejs.org#Collection-fetch) with the given options and invokes the callback when the fetch is completed.
6
+
Calls `fetch` for the [model](http://backbonejs.org#Model-fetch) or [collection](http://backbonejs.org#Collection-fetch) with the given options and invokes the callback after the fetch is completed.
Copy file name to clipboardexpand all lines: fetcher/index.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ title: "Fetcher - RendrJS"
5
5
6
6
# Fetcher
7
7
8
-
The Fetcher is initialized during the [app](/app) initialization. The class is designed to fetch data from an API on the client or server. It is attached to the app object and initializes the [Model Store](/model-store) and the [Collection Store](/collection-store). It also mixes in the [Backbone.Events](http://backbonejs.org#Events) to allow you to trigger the events on client or server the same way you would in Backbone.
8
+
The Fetcher is initialized during the [app](/app) initialization and is attached to the app object. This class is designed to fetch data from an API on the client or server. It initializes the [Model Store](/model-store) and [Collection Store](/collection-store), and mixes in the [Backbone.Events](http://backbonejs.org#Events) to allow you to trigger events on client or server the way you would in Backbone.
Copy file name to clipboardexpand all lines: model/index.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,6 @@ title: "Model - RendrJS"
7
7
8
8
Rendr models extend [Backbone Models](http://backbonejs.org#Model). They are configured to run on the client and server, though some of the functionality works a little different between the two. You won't normally need to worry about these differences in your project.
9
9
10
-
The model also mixes-in the **[syncer](/syncer)** functionality for fetching data from an API on the client or the server.
10
+
The model also mixesin the **[syncer](/syncer)** functionality for fetching data from an API on the client or the server.
0 commit comments