diff --git a/docs/mithril.render.md b/docs/mithril.render.md index a391156c..c887cff5 100644 --- a/docs/mithril.render.md +++ b/docs/mithril.render.md @@ -3,7 +3,7 @@ --- - [Usage](#usage) -- [Subtree directives](#subtree directives) +- [Subtree directives](#subtree-directives) - [Signature](#signature) --- diff --git a/docs/mithril.request.md b/docs/mithril.request.md index 2b474861..e4b58c4c 100644 --- a/docs/mithril.request.md +++ b/docs/mithril.request.md @@ -10,7 +10,7 @@ - [Casting the Response Data to a Class](#casting-the-response-data-to-a-class) - [Unwrapping Response Data](#unwrapping-response-data) - [Using Different Data Transfer Formats](#using-different-data-transfer-formats) -- [File uploads with FormData](#file-uploads-with-form-data) +- [File uploads with FormData](#file-uploads-with-formdata) - [Using variable data formats](#using-variable-data-formats) - [Extracting Metadata from the Response](#extracting-metadata-from-the-response) - [Custom request rejections](#custom-request-rejections) @@ -168,7 +168,7 @@ var log = function(value) { } var users = m.request({method: "GET", url: "/user"}) - .then(log); + .then(log) .then(function(users) { //add one more user to the response return users.concat({name: "Jane"}) @@ -338,7 +338,7 @@ You can read more about the [promise exception monitor here](mithril.deferred.md The `config` option can be used to arbitrarily configure the native XMLHttpRequest instance and to access properties that would not be accessible otherwise. -The example below show how to configure a request where the server expects requests to have a `Content-Type: application/json` header +The example below shows how to configure a request where the server expects requests to have a `Content-Type: application/json` header ```javascript var xhrConfig = function(xhr) { @@ -477,9 +477,9 @@ where: Determines whether the `m.request` can affect template rendering. Defaults to false. - If this option is set to true, then the request does NOT call [`m.startComputation` / `m.endComputation`](mithril.computation.md), and therefore the completion of the request does not trigger an update of the view, even if data has been changed. This option is useful for running operations in the background (i.e. without user intervention). + If this option is set to true, then the request does NOT call [`m.startComputation` / `m.endComputation`](mithril.computation.md), and therefore the completion of the request does not trigger an update of the view, even if data has been changed. This option is useful for running operations in the background (i.e. without user intervention). It's strongly recommended that you set an `initialValue` option in ALL requests if you set the `background` option to true. - In order to force a redraw after a background request, use [`m.redraw`](mithril.redraw.md) + In order to force a redraw after a background request, use [`m.redraw`](mithril.redraw.md), or `m.startComputation` / `m.endComputation`. ```javascript var demo = {} @@ -508,6 +508,8 @@ where: The value that populates the returned getter-setter before the request completes. This is useful when using the `background` option, in order to avoid the need for null checks in views that may be attempting to access the returned getter-setter before the asynchronous request resolves. + It is strongly recommended that you always set this option to avoid future surprises. + - **any unwrapSuccess(any data, XMLHttpRequest xhr)** (optional) A preprocessor function to unwrap the data from a success response in case the response contains metadata wrapping the data. diff --git a/docs/mithril.route.md b/docs/mithril.route.md index a9305aa5..af9f9390 100644 --- a/docs/mithril.route.md +++ b/docs/mithril.route.md @@ -8,7 +8,7 @@ - [Running clean up code on route change](#running-clean-up-code-on-route-change) - [Redirecting](#redirecting) - [Reading the currently active route](#reading-the-currently-active-route) -- [Mode abstraction](#mode abstraction) +- [Mode abstraction](#mode-abstraction) --- @@ -78,7 +78,7 @@ This redirects to the URL `http://server/#/dashboard/johndoe` and yields: Above, `dashboard` is a module. It contains a `controller` and a `view` properties. When the URL matches a route, the respective module's controller is instantiated and passed as a parameter to the view. -In this case, since there's only route, the app redirects to the default route `"/dashboard/johndoe"`. +In this case, since there's only one route, the app redirects to the default route `"/dashboard/johndoe"`. The string `johndoe` is bound to the `:userID` parameter, which can be retrieved programmatically in the controller via `m.route.param("userID")`.