Skip to content

Commit 008d69c

Browse files
committed
Merge pull request #6 from letitia/app-fetcher-docs-edits
App and Fetcher documentation edits
2 parents d00bb3b + c74ac19 commit 008d69c

File tree

12 files changed

+25
-27
lines changed

12 files changed

+25
-27
lines changed

_app/bootstrapData.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ header: bootstrapData
33
example: App.bootstrapData(modelMap)
44
---
55

6-
Generally, invoked in the layout file following the [constructor](#constructor) call. This will simply invoke the [Fetcher.bootstrapData](/fetcher#bootstrapData) function.
6+
This is generally invoked in the layout file following the [constructor](#constructor) call. This will simply call the [Fetcher.bootstrapData](/fetcher#bootstrapData) function.

_app/config.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ example:
66
The options that can be passed into the Rendr App object.
77

88
- **dataAdapterConfig** Standard way of configuring the built-in RestAdapter, which is a simple REST pass through.
9-
- **dataAdapter** _optional_ Allows you to override the default dataAdapter. The default is a simple REST pass through. If the `dataAdapter` option is set, the `dataAdapterConfig` will be ignored
9+
- **dataAdapter** _optional_ Allows you to override the default dataAdapter. The default is a simple REST pass through. If the `dataAdapter` option is set, the `dataAdapterConfig` will be ignored.
1010
- **apiPath** _optional_ Root of the API proxy's virtual path. Anything after this root will be followed by a `-`. Example: `/api/-/path/to/resource`. Allows the proxy to intercept API routes. Can also be a full path to a remote API `http://api.myserver`. The default is set to: `api`
11-
- **appData** _optional_ Pass any data that needs to be accessible by the client. Accessible from within your Handlebars context `app.attributes.myAttr`, and also within your views and models `this.app.attributes.myAttr`.
11+
- **appData** _optional_ Pass any data that needs to be accessible by the client. You can access this data from within your Handlebars context as `app.attributes.myAttr`, and from within your views and models as `this.app.attributes.myAttr`.
1212
- **defaultEngine** _optional_ Tell the ViewEngine to load different file types. For example: `coffee`. By default this is set to `js`.
1313
- **entryPath** _optional_ Root path for the app. Default: `process.cwd() + '/'` (the current working directory)
14-
- **errorHandler** _optional_ Callback for [Express.js errors](http://expressjs.com/guide.html#error-handling)
15-
- **notFoundHandler** _optional_ Callback for [Express.js not found errors](http://expressjs.com/guide.html#error-handling)
16-
- **viewEngine** _optional_ Provides a way to set a custom [Express.js ViewEngine](http://expressjs.com/api.html#app.engine)
14+
- **errorHandler** _optional_ Callback for [Express.js errors](http://expressjs.com/guide/error-handling.html)
15+
- **notFoundHandler** _optional_ Callback for [Express.js not found errors](http://expressjs.com/guide/error-handling.html)
16+
- **viewEngine** _optional_ Set a custom [Express.js ViewEngine](http://expressjs.com/api.html#app.engine)
1717
- **viewsPath** _optional_ Override where the views are stored. This path is relative to `entryPath`. Default value is: `app/views`
1818

1919
Example configuration:

_app/fetch.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ header: fetch
33
example: App.fetch(spec)
44
---
55

6-
Curries the function call for [Fetcher.fetch](/fetcher#fetch). The spec is an object that is formatted to have the name of the result key, then the fetch information.
6+
Curries the function call for [Fetcher.fetch](/fetcher#fetch). The spec is an object containing the name of the result key and the fetch parameters.
77

88
Example spec:
99

@@ -25,8 +25,8 @@ var spec = {
2525
params: { id: 5 }
2626
}
2727

28-
// you can also set a collection to be the focus of the view
28+
// you can also set a collection to be the focus of the view instead of a model
2929
}
3030
```
3131

32-
App.fetch requests generally take place in the [Controller](/controller), which will make the request for all the required data for a given page. These `spec`s are also auto generated when you [lazy load](/view#fetchLazy) a view.
32+
`spec` declarations and `App.fetch` requests usually take place in the [Controller](/controller), which will make the request for all the required data for a given page. These `spec`s are also auto-generated when you [lazy load](/view#fetchLazy) a view.

_app/start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ example: App.start()
55

66
*Client-side only* Starts the [router](/router), and triggers the `start` event.
77

8-
Listen to the `start` event to hook into the code when the app starts up. Activating experiments, loading translations, and starting analytics are pretty common things to do here.
8+
Listen to the `start` event to add handling code when the app starts up. Activating experiments, loading translations, and setting up analytics are pretty common things to do here.

_fetcher/fetch.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ header: fetch
33
example: Fetcher.fetch(fetchSpec, [options], callback)
44
---
55

6-
`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.
77

88
Example `fetchSpec`:
99

@@ -28,16 +28,16 @@ Example `fetchSpec`:
2828
}
2929
```
3030

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).
3232

33-
Extra options to pass a `fetchSpec`:
33+
Extra options to pass to a `fetchSpec`:
3434

3535
- *needsFetch* - Allows you to force a fetch request
3636
- *ensureKeys* - Ensures any stored data has all the required data, if not an API request will be made
3737

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.
3939

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.
4141

4242
Example `options`:
4343

@@ -50,4 +50,4 @@ var opts = {
5050
Fetcher.fetch(fetchSpec, opts, callback);
5151
```
5252

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.

_fetcher/fetchFromApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ header: fetchFromApi
33
example: Fetcher.fetchFromApi(spec, options, callback)
44
---
55

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 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.
77

_fetcher/hydrate.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ header: hydrate
33
example: Fetcher.hydrate(summaries, [options], callback)
44
---
55

6-
The method is used when attaching views to the DOM. It verifies that the data exists for the summary for each child view, this only retrieves data from the [Model Store](/model-store) or the [Collection Store](/collection-store).
6+
This method is called when attaching views to the DOM, specifically when [attaching the child views](/view#attachChildViews). `hydrate` loops through each summary to retrieve the data from the corresponding [Model Store](/model-store) or [Collection Store](/collection-store) for each child view, then it invokes the specified callback.
77

88
Arguments:
99

1010
- `summaries` can be generated by the [Fetcher.summarize](#summarize) function.
1111
- `options` *optional* can be used to pass an instance of the [app](/app).
12-
- `callback` callback function, what you want to invoke after the data is retrieved from the store.
13-
14-
This function is used when [attaching the child views](/view#attachChildViews).
12+
- `callback` this function is invoked after the data is retrieved from the store.

_fetcher/pendingFetches.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ header: pendingFetches
33
example: Fetcher.pendingFetches
44
---
55

6-
Is a counter to the number of items currently being fetched. The [fetch](#fetch) function keeps track of the number of pending fetches.
6+
A counter for the number of items currently being fetched. The [fetch](#fetch) function keeps track of the number of pending fetches.

_fetcher/storeResults.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ header: storeResults
33
example: Fetcher.storeResults(results)
44
---
55

6-
Stores each of the items in the `results` object to the corresponding store.
6+
Saves each item from the `results` object into the corresponding store.

app/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ title: App - RendrJS
55

66
# App
77

8-
The App is a specialized [Model](/model). The app is the place where a lot of the choices between client / server happen. Here are some of the major features of the app:
8+
The App is a specialized [Model](/model). A lot of the choices between client / server happen in the app. Here are some of its major features:
99

1010
- Defines the template adapter
1111
- Initializes the client / server [router](/router)
1212
- Initializes the [fetcher](/fetcher)
13-
- Initializes [modelUtils](/model-utils)
13+
- Initializes modelUtils
1414
- Initializes the app view, which in turn will initialize all views in use
1515
- [Starts](#start) the client-side [router](/router)
1616
- [Bootstraps the data](#bootstrapData) from the server into the client

0 commit comments

Comments
 (0)