5 ms·
Are mere users still not allowed to interface with JS from Elm? I lost all interest when that came down.
by kryptiskt 7y ago
Are mere users still not allowed to interface with JS from Elm? I lost all interest when that came down.
- neoberg 7y agoI don't think there will ever be a way to interface js directly from elm or vise versa. Ports are the only way.
- jlengrand 7y agoHa, OP meant directly? Well AFAIK that is simply not possible, to keep the purity of Elm programs. All has to go through the Elm architecture. Or am I mistaken?
- neoberg 7y agoSorry for the late answer but yes it's not possible to keep elm's purity and safety while having a direct interface to js.
- jlengrand 7y agoYou mean ports and flags? It's described right in the tutorial : https://guide.elm-lang.org/interop/ports.html https://guide.elm-lang.org/interop/ports.html. I wouldn't call it not possible. It is necessary to have the cool stuff of Elm, unfortunately (or not). It's not rocket science tough, and it allows for clean interfaces. I wrote about it just a couple ago ago : https://lengrand.fr/a-short-introduction-to-ports-and-flags-in-elm/ https://lengrand.fr/a-short-introduction-to-ports-and-flags-...
- masklinn 7y agoJS interop has never been an issue, it's publishing JS-interop packages which is gated[0]: port module is available in applications but not packages. [0] formerly behind a review queue / review process to add to native-whitelist, now limited to two specific "core" organisations
- seddona 7y agoWe have a large Elm app and do the occasional bit of JS interop when required, it's not a problem at all. The 0.19 change simply limited the ability to publish packages containing interop to the official Elm package repository. You can still host your own packages etc.
- yakshaving_jgt 7y agoIf you need your IO to be synchronous, then Elm is not for you. Asynchronous IO through ports works just fine.
- fortran77 7y agoPlease don't spread lies about Elm. It's OK if it's too hard for you, or not your cup of tea. But it's straightforward to interface JS from Elm. It's right in the tutorial under ports.