from HAMILTON
I make web development courses and have a podcast called Syntax
These slides will be available shortly after this talk
I'll tweet the link out.
A mix bag of tips and techniques that will make you a better JS developer, regardless of which framework you use
With Intersection Observer, you can be alerted when an element is fully or partially scrolled into or out of view.
per-element resize events!
Handy, even in frameworks!
Finds the closest ancestor that matches the passed selector
Great for Click Outside
Does this element match the selector?
The best 11 lines of code
The Intl object is the namespace for the ECMAScript Internationalization API
Turns an iterable into an array
When all resolve()
Short circuits when one reject()s
It takes an array of baby promises and makes a Mega promise
They run concurrently (at the same time)
When one resolve() or reject()
When one resolve() or all reject()
Stage 1
When all finished - can be mix of resolve() or reject()
Stage 3
A few options
Option #1
Why waste dev time on something that should never happen? #ProblemSolved
Option #2
Wrap that sucker in a safety blanket
Option #3
Async Functions can chain a .catch()
Just Live Your Life
Create a HOF
Hot Shot Implicit Return (WHAT)
Create a new function with your HOF
Normally we'd Handle each possible Error with next()
🤔 But that doesn't cover errors we throw, unhandled errors or syntax errors...
We need to catch all errors and pass along to the next middleware function
Then we just wrap our routes!
Any unhandled error will simply get passed along to next()
Option #4
Option #5
Node.js will soon exit your process on unhandled rejected promises
This is the part of the talk where
I check how much time I have left
Not totally a standard yet
DEMO TIME
Questions?
(I have lots of stickers too!)