BeaconCMS / beacon

Open-source content management system (CMS) built with Phoenix LiveView. Faster render times to boost SEO performance, even for the most content-heavy pages.
https://beaconcms.org
MIT License
873 stars 88 forks source link

Add support for user-defined client JS hooks #284

Open leandrocp opened 1 year ago

leandrocp commented 1 year ago

Allow users to pass https://hexdocs.pm/phoenix_live_view/js-interop.html#client-hooks-via-phx-hook to the Beacon livesocket.

The socket is initialized at https://github.com/BeaconCMS/beacon/blob/4dd3b55475eae63fd8594f22510bae6a71c8a9d7/assets/js/beacon.js#L31 and note it does reuse the LiveView object from the host app and connects to the same socket path. It's important to reuse the same JS client version to avoid misbehavior.

Ideally the hook code should be stored in the DB and changed at runtime in the admin interface but that imposes some challenges on how to inject the js hook code into the socket.

AZholtkevych commented 1 year ago

For now according to the team in the backlog. Could come back in Q4