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:
parent
489420e9fa
commit
f98bf3302d
@ -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)
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user