added promise example to the "Chaining operations" section of the styleguide

This commit is contained in:
spalger 2015-10-29 13:36:23 -05:00
parent c9c9e565e6
commit ad3208a42a

View file

@ -505,6 +505,13 @@ d3.selectAll('g.bar')
.each(function() ... )
```
```js
$http.get('/info')
.then(({ data }) => this.transfromInfo(data))
.then((transformed) => $http.post('/new-info', transformed))
.then(({ data }) => console.log(data));
```
*Wrong:*
```js
@ -519,6 +526,13 @@ d3.selectAll('g.bar')
.each(function() ... )
```
```js
$http.get('/info')
.then(({ data }) => this.transfromInfo(data))
.then((transformed) => $http.post('/new-info', transformed))
.then(({ data }) => console.log(data));
```
## Name your closures
Feel free to give your closures a descriptive name. It shows that you care about them, and
@ -867,7 +881,7 @@ When a node has multiple attributes that would cause it to exceed the line chara
attribute1="value1"
attribute2="value2"
attribute3="value3">
<li></li>
<li></li>
...