htmx/www/posts/2020-5-24-htmx-0.0.4-is-released.md
2021-05-25 09:35:36 -06:00

63 lines
2.1 KiB
Markdown

---
layout: layout.njk
tags: ['posts', 'announcements']
title: htmx 0.0.4 has been released!
date: 2020-05-24
---
## htmx 0.0.4 Release
I'm pleased to announce the [0.0.4 release](https://unpkg.com/browse/htmx.org@0.0.4/) of htmx, this time with no
project renaming.
#### Changes
This one had a lot of code clean up along with two major features:
##### Extensions
First off, htmx now has a proper [extensions](/extensions) mechanism, allowing us to create extensions that plug
in to the htmx life cycle and provide functionality that isn't in the core library. Some extensions that have shipped
with this release and that you might find useful include:
* [`morphdom-swap`](/extensions/morphdom-swap) - allows you to use the morphdom library for swapping in new content
* [`class-tools`](/extensions/class-tools) - replaces the retired `hx-classes` attribute
* [`json-enc`](/extensions/json-enc) - allows you to encode AJAX request bodies in JSON
See the full list of included [extensions here](/extensions#included).
This extension mechanism will allow us to introduce useful HTML-oriented features while keeping the core htmx code
focused on loading content.
##### Web Socket & Reworked Server Sent Events Support
htmx now has experimental support for [Web Sockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications)
with the [hx-ws](/attributes/hx-ws) attribute:
```html
<div hx-ws="connect wss:/chatroom">
<div id="chat_room">
...
</div>
<form hx-ws="send">
<input name="chat_message">
</form>
</div>
```
Additionally, the [Server Sent Event](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
support attribute was renamed to [hx-sse](/attributes/hx-sse) and the syntax was standardized with the new web socket support
syntax:
```html
<div hx-sse="connect /event_stream">
<div hx-get="/chatroom" hx-trigger="sse:chatter">
...
</div>
</div>
```
There were also many, many bug fixes, many of them contributed by other developers. So a big thank you to everyone
who helped!
Enjoy!