Merge pull request #5235 from spalger/styleguideClarification
added promise example to the "Chaining operations" section of the styleguide
This commit is contained in:
commit
c6791486ce
1 changed files with 15 additions and 1 deletions
|
@ -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>
|
||||
...
|
||||
|
|
Loading…
Reference in a new issue