I’ve been writing a bunch of jest tests recently for libraries that use the underlying
window.crypto methods like
window.crypto.subtle key management methods. One problem I run into is that the
window.crypto object isn’t available, so I need to shim it.
To use the
window.crypto methods, you will need Node 15+. You can set the
window.crypto by importing the
crypto package and setting it on the global:
const crypto = require('crypto').webcrypto; // Shims the crypto property onto global global.crypto = crypto;
I really loathe creating mock functions for missing libraries in Node because they can lead to faulty positives on tests; I really appreciate
webcrypto being available!
You’ve probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don’t see what makes them so special. Can’t you just use a callback? What’s the big deal? In this article, we’ll…
CSS filter support recently landed within WebKit nightlies. CSS filters provide a method for modifying the rendering of a basic DOM element, image, or video. CSS filters allow for blurring, warping, and modifying the color intensity of elements. Let’s have…
Event Delegation with MooTools
Rotate Elements with CSS Transformations