-
Notifications
You must be signed in to change notification settings - Fork 8
/
jsweekly.html
180 lines (145 loc) · 10.5 KB
/
jsweekly.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<html>
<head>
<link rel="stylesheet" href="/website/style.css">
<link href="//fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
<div class="left">
<img id="cover" src="/content/mock_lite.jpeg" />
</div>
<div class="right">
<h1 class="title">Mastering Async/Await <small>v1.1.0</small></h1>
<h3 class="tagline">
Become your team's expert on escaping callback hell.
</h3>
<p>
Imagine writing your entire <a href="http://expressjs.com/">Express</a> API
or <a href="https://reactjs.org/">React</a> app with for loops and if
statements. No more deeply nested callbacks or convoluted promise chains.
With async/await, you can make that dream a reality.
</p>
<p>
<i>Mastering Async/Await</i> provides a concise and comprehensive guide to
async/await fundamentals. You'll learn:
</p>
<ul>
<li>Why React and Express don't support async/await out of the box, and how to work around these frameworks' limitations.</li>
<li>How to evaluate whether your favorite <a href="http://npmjs.com/">npm</a> modules support async/await.</li>
<li>How promises work under the hood, in excruciating detail, by building a <a href="https://promisesaplus.com/">Promises/A+</a> compliant promise library from scratch.</li>
<li>Why async/await is the perfect complement to promises, rather than an alternative.</li>
<li>How to use async/await to handle errors and keep nasty red error messages out of your Chrome console.</li>
<li>Why async/await works perfectly with <code>for</code> loops and <code>if</code> statements, but not functional constructs like <code>forEach</code>.</li>
<li>How to avoid common async/await mistakes, like using <code>return</code> in a <code>try/catch</code>.
</ul>
<p>
<i>Mastering Async/Await</i> packs all this and more into 52 terse pages.
That means you can get caught up on modern asynchronous JavaScript in hours,
not days. Stop copy/pasting snippets from
StackOverflow and become the expert your team goes to for all things async.
</p>
<p class="update">
Updated for 2021, including answers to the exercises and a new section on <a href="https://thecodebarbarian.com/async-generator-functions-in-javascript.html">async generator functions</a>.
</p>
<h3>About the Author</h3>
<p id="author">
<img src="/images/val.jpg" style="float: right; width: 145px; margin-left: 10px">
Valeri Karpov is the lead maintainer of <a href="https://www.npmjs.com/package/mongoose">Mongoose</a>.
He's a core contributor to
<a href="https://www.npmjs.com/package/mocha">Mocha</a>, <a href="https://www.npmjs.com/package/agenda">Agenda</a>,
and other npm modules with over 10M combined monthly downloads.
He's the author of <a href="http://es2015generators.com/"><i>The 80/20 Guide to ES2015 Generators</i></a>
and <a href="https://www.amazon.com/Professional-AngularJS-Valeri-Karpov/dp/1118832078/ref=sr_1_1?ie=UTF8&qid=1528769632&sr=8-1&keywords=professional+angularjs"><i>Professional AngularJS</i></a>.
<a href="http://thecodebarbarian.com/">His blog</a>
is the top result on Google for "async await design patterns".
<div class="clear"></div>
</p>
<p>
Check out
<a href="https://devchat.tv/js-jabber/jsj-329-promises-promise-finally-and-async-await-with-valeri-karpov/">Valeri Karpov on JavaScript Jabber</a>,
one of the
<a href="https://snipcart.com/blog/javascript-podcasts">top JavaScript podcasts</a>.
</p>
<p>
Check out <a href="https://javascriptweekly.com/issues/413">Valeri Karpov on JavaScript Weekly</a>,
the <a href="https://usersnap.com/blog/web-development-newsletters/">#1 JavaScript newsletter</a>.
</p>
<h3>Preview</h3>
<ul>
<li><a href="/bin/toc.pdf">Table of Contents</a></li>
<li><a href="/bin/page-30-31.pdf">Pages 30-31</a></li>
</ul>
<h3>Buy</h3>
<div class="price">
$29.99
</div>
<script src="https://js.stripe.com/v3/"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<div class="buy-button" onclick="stripeCheckout()">
Buy Now
</div>
<script type="text/javascript">
var stripeKey = 'pk_live_51IoDkvEIfgvH77vtfJZwToZlC20FilHNRViMce42TBCeFsptEIkUcjz09MMPbfn4pU9St2nM8P9aYlL4l7q8SLbf00ivnWmIpw';
var stripe = Stripe(stripeKey);
var server = 'https://masteringjs-job-board.azurewebsites.net';
var status = 'init';
function stripeCheckout() {
if (status !== 'init') {
return;
}
document.querySelector('.buy-button').innerHTML = 'Checking Out...';
axios.post(server + '/api/createEbookCheckout', { itemNumber: '0001' }).then(function(response) {
document.querySelector('.buy-button').innerHTML = 'Buy Now';
status = 'paid';
return stripe.redirectToCheckout({ sessionId: response.data.id });
}).catch(() => {
document.querySelector('.buy-button').innerHTML = 'Buy Now';
status = 'init';
});
}
window.addEventListener('scroll', function() {
var diff = document.querySelector('#purchase').getBoundingClientRect().top - window.innerHeight;
if (diff <= -50) {
document.querySelector('.sticky-promo').classList.add('hide');
document.querySelector('.sticky-promo-mobile').classList.add('hide');
} else {
document.querySelector('.sticky-promo').classList.remove('hide');
document.querySelector('.sticky-promo-mobile').classList.remove('hide');
}
});
</script>
<div class="money-back">
<p>
<i>
Have an issue?
<a href="https://github.com/vkarpov15/mastering-async-await-issues/issues">Report it on GitHub</a>
and we'll respond within 24 hours
</i>.
</p>
<p>
<i>
Not happy with your purchase?
Email <a href="mailto:[email protected]">[email protected]</a> with your
transaction id for a full refund within 72 hours.
</i>
</p>
</div>
<h3>What Developers are Saying</h3>
<blockquote data-cards="hidden" class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">So I started reading "Mastering Async/Await" by <a href="https://twitter.com/code_barbarian?ref_src=twsrc%5Etfw">@code_barbarian</a> - and just like his "Generators guide" it is an awesome practical tutorial for all the ways you should be using "async/await" in JS. No fluff, straight examples, great text. <a href="https://t.co/nnAEFhtTjj">https://t.co/nnAEFhtTjj</a></p>— Gleb Bahmutov (@bahmutov) <a href="https://twitter.com/bahmutov/status/1013882918941446146?ref_src=twsrc%5Etfw">July 2, 2018</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<blockquote data-cards="hidden" class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">So, like I said a few minutes ago, I purchased "Mastering Async/Await" from <a href="https://twitter.com/code_barbarian?ref_src=twsrc%5Etfw">@code_barbarian</a> , well he happens to have another book<a href="https://t.co/gr0TZNCSJN">https://t.co/gr0TZNCSJN</a><br>The 80/20 Guide to ES2015 Generators. I feel like it's Christmas.<br><br>Thanks <a href="https://twitter.com/code_barbarian?ref_src=twsrc%5Etfw">@code_barbarian</a>, can't wait to start reading.</p>— Tony Brown ⚛️ ❤️ 💻 👑 (@pixelBender67) <a href="https://twitter.com/pixelBender67/status/1042367743620784130?ref_src=twsrc%5Etfw">September 19, 2018</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<blockquote data-cards="hidden" class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Just bought the "Mastering async/await" book from <a href="https://twitter.com/code_barbarian?ref_src=twsrc%5Etfw">@code_barbarian</a>.<br>Thank you Valeri for putting this together!<br><br>Find it here: <a href="https://t.co/WnsH4tqDld">https://t.co/WnsH4tqDld</a> <a href="https://t.co/KYh5QZROap">pic.twitter.com/KYh5QZROap</a></p>— Marcus Poehls ⚡️ (@marcuspoehls) <a href="https://twitter.com/marcuspoehls/status/1014520503485259779?ref_src=twsrc%5Etfw">July 4, 2018</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<blockquote data-cards="hidden" class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">I'm super impressed with <a href="https://twitter.com/code_barbarian?ref_src=twsrc%5Etfw">@code_barbarian</a> 's latest ebook: Mastering Async/Await. Check it out: <a href="https://t.co/8tsaVfSjsN">https://t.co/8tsaVfSjsN</a></p>— Brad Vogel (@BradVogel) <a href="https://twitter.com/BradVogel/status/1016473731332390913?ref_src=twsrc%5Etfw">July 10, 2018</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<blockquote data-cards="hidden" class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">I've been awaiting to read "Mastering Async/Await" by <a href="https://twitter.com/code_barbarian?ref_src=twsrc%5Etfw">@code_barbarian</a> (<a href="https://t.co/4AOjVSTpTz">https://t.co/4AOjVSTpTz</a>) and finally resolved the promise. Concise and very informative! My ebook was not spiral-bound, but contents were otherwise as described ;-). <a href="https://twitter.com/hashtag/GoodReads?src=hash&ref_src=twsrc%5Etfw">#GoodReads</a> <a href="https://twitter.com/hashtag/nodejs?src=hash&ref_src=twsrc%5Etfw">#nodejs</a> <a href="https://t.co/b4jQwQniXQ">pic.twitter.com/b4jQwQniXQ</a></p>— Stennie (@stennie) <a href="https://twitter.com/stennie/status/1045154322202353664?ref_src=twsrc%5Etfw">September 27, 2018</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<blockquote data-cards="hidden" class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">From the maintainer of my favorite <a href="https://twitter.com/MongoDB?ref_src=twsrc%5Etfw">@MongoDB</a> library <a href="https://twitter.com/mongoosejs?ref_src=twsrc%5Etfw">@mongoosejs</a>, comes a new book giving a deep dive on learning and understanding Async/Await, one of the best new features of es6.<br><br>ch-ch-ch-check it outtt <a href="https://t.co/givAinTbPV">https://t.co/givAinTbPV</a></p>— Harry Wolff (@hswolff) <a href="https://twitter.com/hswolff/status/1007340590210699265?ref_src=twsrc%5Etfw">June 14, 2018</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
<div style="clear: both"></div>
</div>
<script type="text/javascript" src="/website/track.js"></script>
</body>
</html>