bartblast

bartblast OP

Creator of Hologram

Hologram v0.8.0 is out! This release brings JavaScript interoperability - the most requested feature since the project’s inception. You can now call JS functions, use npm packages, interact with Web APIs, instantiate classes, and work with Web Components - all from Elixir code, with zero latency on the client side.

Special thanks to @robak86 for extensive help with the JS interop API design. Thanks to @ankhers for contributing Web Components support and to @mward-sudo for a language server compatibility fix and :unicode module refactoring.

Thanks to our sponsors for making sustained development possible: Curiosum (Main Sponsor), Erlang Ecosystem Foundation (Milestones Sponsor), and our GitHub sponsors - Innovation Partner: @sheharyarn, Framework Visionaries: @absowoot, Oban, @Lucassifoni, @robertu, and all other GitHub sponsors.

Full details in the blog post: Hologram v0.8.0: Elixir Gets JavaScript Interop

First 5 of 5 Posts Switch mode

mward-sudo

mward-sudo

Massive release!

I’ve not played with the new JS interop, but the API looks very well considered. Hologram is moving into very interesting territory.

I look forward to continuing to contribute and to using the project for something real sometime soon.

bartblast

bartblast OP

Creator of Hologram

Thank you @mward-sudo! It was a massive amount of work indeed - I think @robak86 aged about 5 years during the API design sessions alone. The fact that he still answers my phone calls is either a testament to his patience or evidence that he hasn’t figured out how to block a number yet… Or maybe he just picks up out of morbid curiosity about what I’ll ask next.

10
Post #3
jam

jam

Amazing! Looks very comprehensive.

jam

jam

I’m sure y’all considered this as part of the design but I can’t help but think how clean it’d be to drop the brackets and create the list as an implementation detail under the hood.

So this

result =
  :Decimal
  |> JS.new([100])
  |> JS.call(:plus, [23])
  |> JS.call(:toNumber, [])  

becomes

result =
  :Decimal
  |> JS.new(100)
  |> JS.call(:plus, 23)
  |> JS.call(:toNumber)  
bartblast

bartblast OP

Creator of Hologram

Unfortunately there are two problems with dropping the brackets:

  1. List ambiguity - JS.call(:obj, :processList, [1, 2, 3]) becomes impossible to distinguish between one argument (the array [1, 2, 3]) and three separate arguments.

  2. Arity clash - JS.call/2 calls a standalone function, JS.call/3 calls a method on a receiver. If args were optional, JS.call(:Decimal, :toNumber) could be either call/2 with one arg or call/3 with no args.

The explicit args list is also consistent with Kernel.apply/3, which always requires the args list. I actually considered naming it JS.apply at one point, so the parallel is intentional.

— All posts loaded —

Where Next? Top

Trending in News & Updates Top

kip
I’m a bit excited to announce that Localize and friends are now at release 1.0. Even though it’s a 1.0 release, it stands on 8 years of w...
New
bartblast
After building Hologram and sharing updates across various places, I’ve realized there’s a lot happening that doesn’t always make it to t...
New
nseaSeb
Just published search_ash 0.5.0 (with search_core 0.4.0) on Hex. What’s new: synonyms You can now declare a synonym dictionary per lang...
New
mudasobwa
After years of struggling I made StreamData dependency optional. Finitomata.ExUnit got testing primitives for Persistence. Full back co...
New
bartblast
Hologram v0.11 is out! Two headline features this release. First, Elixir regexes now run in the browser. They were server-only until now,...
New
sullyMusty
ActiveMemory 0.8.0 — in-memory tables that speak Ecto ActiveMemory 0.8.0 is now on Hex. ActiveMemory is an in-memory store built on ETS ...
New
mudasobwa
MdexMultilineCells is an MDEx plugin enabling multi-line cells in Markdown tables with full inline/block Markdown rendering and automati...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New

We're in Beta

About us Mission Statement