You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/assets/js/liveview/phx_events.js

14 lines
403 B
JavaScript

window.addEventListener(`phx:update-value`, (e) => {
let el = document.getElementById(e.detail.id)
el.value = e.detail.value
if (e.detail.fire) {
el.dispatchEvent(new Event("input", { bubbles: true }))
}
})
window.addEventListener(`phx:js-exec`, ({ detail }) => {
document.querySelectorAll(detail.to).forEach(el => {
window.liveSocket.execJS(el, el.getAttribute(detail.attr))
})
})