♻️ Reblog of
Jared White (jaredwhite@indieweb.social
)
Whoa…I totally missed this back in November. Safari has added support for class static initialization blocks and it will be in 16.4! One of my favorite features in Ruby—the ability to run code right at the class definition level—is available in JavaScript too thanks to ES2022!
https://webkit.org/blog/13575/release-notes-for-safari-technology-preview-157/
I'm so excited. 😍 Registering custom elements will be a breeze!
```js
class MyElement extends HTMLElement {
static {
customElements.define("my-el", this)
}
}
```