diff --git a/docs/api.md b/docs/api.md index 77c2b0d8..eb2a7b31 100644 --- a/docs/api.md +++ b/docs/api.md @@ -124,8 +124,8 @@ var querystring = m.buildQueryString({a: "1", b: "2"}) #### m.withAttr(attrName, callback) - [docs](withAttr.md) ```javascript -var state: { - value = "" +var state = { + value: "", setValue: function(v) {value = v} } diff --git a/docs/introduction.md b/docs/introduction.md index 52c12158..374c6468 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -23,10 +23,10 @@ The easiest way to try out Mithril is to include it from a CDN, and follow this Let's create an HTML file to follow along: ```markup -
+ @@ -39,6 +39,8 @@ var root = document.getElementById("root") Let's start as small as well can: render some text on screen. Copy the code below into your file (and by copy, I mean type it out - you'll learn better) ```javascript +var root = document.body + m.render(root, "Hello world") ``` diff --git a/docs/lint.js b/docs/lint.js index db4dd5dc..cf8859f7 100644 --- a/docs/lint.js +++ b/docs/lint.js @@ -135,11 +135,11 @@ function traverseDirectory(pathname, callback) { //run traverseDirectory("./docs", function(pathname) { - if (pathname.indexOf(".md") > -1 && !pathname.match(/migration|zero|simple|node_modules/)) { + if (pathname.indexOf(".md") > -1 && !pathname.match(/migration|node_modules/)) { fs.readFile(pathname, "utf8", function(err, data) { if (err) console.log(err) else lint(pathname, data) }) } }) - +.then(process.exit) diff --git a/docs/request.md b/docs/request.md index cbd887a6..cd204844 100644 --- a/docs/request.md +++ b/docs/request.md @@ -55,6 +55,7 @@ Argument | Type | Required | Descr `options.deserialize` | `any = Function(string)` | No | A deserialization method to be applied to the response. Defaults to a small wrapper around `JSON.parse` that returns `null` for empty responses. `options.extract` | `string = Function(xhr, options)` | No | A hook to specify how the XMLHttpRequest response should be read. Useful for reading response headers and cookies. Defaults to a function that returns `xhr.responseText`. If defined, the `xhr` parameter is the XMLHttpRequest instance used for the request, and `options` is the object that was passed to the `m.request` call. If a custom `extract` callback is set, `options.deserialize` is ignored and the string returned from the extract callback will not be parsed as JSON. `options.useBody` | `Boolean` | No | Force the use of the HTTP body section for `data` in `GET` requests when set to `true`, or the use of querystring for other HTTP methods when set to `false`. Defaults to `false` for `GET` requests and `true` for other methods. +`options.background` | `Boolean` | No | If `false`, redraws mounted components upon completion of the request. If `true`, it does not. Defaults to `false`. **returns** | `Promise` | | A promise that resolves to the response data, after it has been piped through the `extract`, `deserialize` and `type` methods [How to read signatures](signatures.md) diff --git a/docs/withAttr.md b/docs/withAttr.md index 9fd7a7df..10638e51 100644 --- a/docs/withAttr.md +++ b/docs/withAttr.md @@ -13,8 +13,8 @@ Returns an event handler that runs `callback` with the value of the specified DOM attribute ```javascript -var state: { - value = "" +var state = { + value: "", setValue: function(v) {value = v} }