update docs, add descriptions for api methods
This commit is contained in:
parent
d56c30cc4a
commit
cdb9017a72
25 changed files with 613 additions and 40 deletions
|
|
@ -12,13 +12,13 @@
|
|||
|
||||
### What is Mithril?
|
||||
|
||||
Mithril is a framework for developing Javascript-based Single Page Applications. It's designed to be fast, small and economical.
|
||||
Mithril is a framework for building Single Page Applications. It's small but batteries-included.
|
||||
|
||||
---
|
||||
|
||||
### Getting started
|
||||
|
||||
The easiest way to try out Mithril is to include it from a CDN, and follow this tutorial. It'll only take 10 minutes.
|
||||
The easiest way to try out Mithril is to include it from a CDN, and follow this tutorial. It'll cover the majority of the API surface but it'll only take 10 minutes.
|
||||
|
||||
Let's create an HTML file to follow along:
|
||||
|
||||
|
|
@ -84,6 +84,8 @@ m("main", [
|
|||
])
|
||||
```
|
||||
|
||||
Note: If you would rather use `<html>` syntax, [you can do so by using Babel](https://babeljs.io/repl/#?code=%2F**%20%40jsx%20m%20*%2F%0A%3Ch1%3EMy%20first%20app%3C%2Fh1%3E).
|
||||
|
||||
---
|
||||
|
||||
### Components
|
||||
|
|
@ -180,7 +182,7 @@ Basically, XHR is just a way to talk to a server.
|
|||
|
||||
Let's change our click counter to make it save data on a server. For the server, we'll use [REM](http://rem-rest-api.herokuapp.com), a mock REST API designed for toy apps like this tutorial.
|
||||
|
||||
First we create a function that calls `m.request`.
|
||||
First we create a function that calls `m.request`. The `url` specifies an endpoint that represents a resource, the `method` specifies the type of action we're taking (typically the `PUT` method [upserts](https://en.wiktionary.org/wiki/upsert)), `data` is the payload that we're sending to the endpoint and `useCredentials` means to enable cookies (a requirement for the REM API to work)
|
||||
|
||||
```javascript
|
||||
var count = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue