sevensidedmarble
All the pieces are there to execute arbitrary JS commands from the server. You can put them on a data property and call them from the client with execJs. But you can’t just do this arbitrarily. You need to make a new hook, dispatch the custom calls to it, and have that hook call execJs.
Wouldn’t it be a lot simpler if LiveView JS just shipped with a hook that could execute any JS commands serialized onto an attribute from the server (ie handle_events)?
I’m aware you can build this yourself without too much trouble but why not just ship this? It would allow anyone to call the full range of JS command stuff from handle_events right out of the box.
Trending in Proposals: Ideas
We are seeing a lot of warning logs like this:
navigate event to "https://someurl" failed because you are redirecting across live_sessio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
greven
Agree with this, think it’s something everyone needs. Hey maybe submit a PR?
sevensidedmarble
Yeah I’d be happy to do the work myself. Just wanted to gauge the interest
cmo
Sounds like a good addition. You don’t need a hook though, just an event listener on the window.
And the JS command:
https://github.com/fly-apps/live_beats/blob/712204ca172ed6d36456c8ed4fd6aaba50099447/lib/live_beats_web/components/core_components.ex#L666
josevalim
Please keep in mind these solutions most likely bypass any future CSP you put in place, making it more vulnerable to XSS attacks. I’d not recommend it as a general solutions and, if someone wants to go down this road, please be aware of the security implications.
sevensidedmarble
Well how does the current JS command system work with CSP? There is nothing out of the box to generate nonces for the commands or something is there?