Skip to content

Things read, heard, watched and found. Now and then a thought of my own.

Timeline

Post 1 min read

Make Alpine 3 support legacy browsers

After The other day, I learned that AlpineJS 3.x uses queueMicrotask — and that that’s an API not supported on Firefox < 69 and Safari < 12.1 (see caniuse for full support information).

Luckily, this can easily be polyfilled:

if (typeof window.queueMicrotask !== "function") { 
    window.queueMicrotask = function (callback) { 
      Promise.resolve() 
        .then(callback) 
        .catch(e => setTimeout(() => { throw e; })); 
    }; 
}

Originally published at https://wentsch.me.

A letter every Monday

The week’s reading, highlights and the odd thought of my own, in one email.

One email a week. Unsubscribe with one click. See a sample