1. Fetch a translation, ignoring the quality
- Promises are chainable, for example by using
- Promises will forward any value.
That means that if a promise resolves, it will forward that value until it reaches the end of the chain or a
.then, which receives the value as its argument.
- Promises will forward any error.
That means that if a promise rejects, it will forward that rejection until it reaches the end of the chain or a
.catch, which receives the value as its argument and can handle it.
2. Fetch a batch of translations, all-or-nothing
- To return a promise with an error, create a
rejectedfrom the start.
- There is a helper method on
Promisethat waits for an array of promises to resolve before it resolves itself.
3. Request a translation, retrying at most 2 times
- Convert the
callbackto a promise using the
4. Fetch a translation, inspect the quality, or request it
- Instead of nesting
.thentakes a second argument which catches everything before (earlier in the chain), ignoring errors in the first argument of