I’ve been writing a bunch of jest tests recently for libraries that use the underlying window.crypto
methods like getRandomValues()
and 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!
Serving Fonts from CDN
For maximum performance, we all know we must put our assets on CDN (another domain). Along with those assets are custom web fonts. Unfortunately custom web fonts via CDN (or any cross-domain font request) don’t work in Firefox or Internet Explorer (correctly so, by spec) though…
Conquering Impostor Syndrome
Two years ago I documented my struggles with Imposter Syndrome and the response was immense. I received messages of support and commiseration from new web developers, veteran engineers, and even persons of all experience levels in other professions. I’ve even caught myself reading the post…
Duplicate the jQuery Homepage Tooltips Using Dojo
The jQuery homepage has a pretty suave tooltip-like effect as seen below: Here’s how to accomplish this same effect using Dojo. The XHTML The above HTML was taken directly from the jQuery homepage — no changes. The CSS The above CSS has been slightly modified to match the CSS rules already…
Create a Dojo Lightbox with dojox.image.Lightbox
One of the reasons I love the Dojo Toolkit is that it seems to have everything. No scouring for a plugin from this site and then another plugin from that site to build my application. Buried within the expansive
dojox
namespace of Dojo is
Source link
Leave a Reply