Hey there!
In this new edition of the Really Good blog, we will try to bring you weekly tips, tricks, thoughts and pointers for good plugins and tools (and maybe some to avoid). Composed directly out of our daily experiences — we hope it will enrich your Front End skills and it might even save you some time and trouble.
This week’s interesting bits
addEventListener supports a (different) third argument
addEventListener now supports options as the third argument in most browsers (instead of the usual boolean) which adds once &passive flags on top of the existing capture flag.
Notice you need feature detection, otherwise passing the settings object will be considered as capture: true for browsers with no support.
Console API – copy()
Run this in your browser’s console: copy({now: new Date(), title: ‘Dwayne “The Rock” Johnson’}) and then paste anywhere. We find it especially useful for copying objects, as it stringifies JSON by itself (see the result in your clipboard, and don’t bother copying DOM nodes as the circular references prevent serialization).
It’s supported in all modern browsers excluding Edge, and here’s some cool things you can do with it:
git bisect
If your code is broken and you need to find the last good commit, finding your way between dozens or hundreds of commits can be very frustrating. git bisect uses a binary search through your commit history to help you identify the faulty commit.
Something we liked
react-rnd – A resizable and draggable component for React. It wraps separate resizable & draggable components by the same author, the API is clear and well-documented, and it’s reliable as far as we’ve experimented.
That’s if for now, thank you for reading. See you next week.
