Hologram v0.8.0: Elixir Gets JavaScript Interop
2 days ago
- #JavaScript
- #Web Development
- #Elixir
- Hologram v0.8.0 introduces JavaScript interoperability, a highly requested feature.
- JS interop allows calling JavaScript functions, using npm packages, interacting with Web APIs, and working with Web Components from Elixir.
- The interop API is located in the Hologram.JS module and includes functions like js_import, JS.call, JS.get, JS.set, JS.new, and JS.dispatch_event.
- Values are automatically boxed/unboxed between Elixir and JavaScript, with opaque types wrapped in Hologram.JS.NativeValue.
- Async support converts JavaScript Promises to Elixir Tasks, enabling seamless integration with Elixir's semantics.
- Web Components support added, allowing direct use of custom HTML elements in templates.
- Language server compatibility fixes and Unicode module refactoring contributed by community members.
- Breaking change: The ~JS sigil now requires explicit use of Hologram.JS.
- Release includes 270 commits, 162 changed files, and significant contributions from sponsors and community members.
- Future plans include porting Elixir's process model to the client side.