1
0
mirror of https://github.com/algora-io/tv.git synced 2025-02-04 01:53:25 +02:00

add phx:js-exec listener

This commit is contained in:
zafer 2024-06-23 22:12:02 +03:00
parent 489420e9fa
commit f98bf3302d

View File

@ -374,6 +374,12 @@ window.addEventListener("phx:page-loading-stop", (info) => topbar.hide());
// Accessible routing
window.addEventListener("phx:page-loading-stop", routeUpdated);
window.addEventListener("phx:js-exec", ({ detail }) => {
document.querySelectorAll(detail.to).forEach((el) => {
liveSocket.execJS(el, el.getAttribute(detail.attr));
});
});
window.addEventListener("js:exec", (e) =>
e.target[e.detail.call](...e.detail.args)
);