不要怂,就是干,撸起袖子干!

Commit 0528f39a by reinerBa Committed by Jan Aagaard Meier

docs: Hint for async (#7887)

* Hint for async

I added a hint for the await keyword wich has increasing support. But maybe useless because everyone should know this possibility for promises.

* Added async docu link

Added furthermore that await only works in async functions.
1 parent a7f18ba6
Showing with 8 additions and 0 deletions
...@@ -138,4 +138,12 @@ User.findOne().then(user => { ...@@ -138,4 +138,12 @@ User.findOne().then(user => {
}); });
``` ```
When your environment or transpiler supports [async/await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) this will work but only in the body of an [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function:
```js
user = await User.findOne()
console.log(user.get('firstName'));
```
Once you've got the hang of what promises are and how they work, use the [bluebird API reference](http://bluebirdjs.com/docs/api-reference.html) as your go-to tool. In particular, you'll probably be using [`.all`](http://bluebirdjs.com/docs/api/promise.all.html) a lot. Once you've got the hang of what promises are and how they work, use the [bluebird API reference](http://bluebirdjs.com/docs/api-reference.html) as your go-to tool. In particular, you'll probably be using [`.all`](http://bluebirdjs.com/docs/api/promise.all.html) a lot.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!