2022-01-25 05:14:17 -05:00
|
|
|
import { disableElement, enableElement } from '../utils/disableElement'
|
2021-09-27 06:45:04 -04:00
|
|
|
|
|
|
|
document.querySelectorAll('[data-ol-multi-submit]').forEach(el => {
|
|
|
|
function setup(childEl) {
|
2022-01-25 05:14:17 -05:00
|
|
|
childEl.addEventListener('pending', () => {
|
|
|
|
el.querySelectorAll('[data-ol-disabled-inflight]').forEach(disableElement)
|
|
|
|
})
|
|
|
|
childEl.addEventListener('idle', () => {
|
|
|
|
el.querySelectorAll('[data-ol-disabled-inflight]').forEach(enableElement)
|
|
|
|
})
|
2021-09-27 06:45:04 -04:00
|
|
|
}
|
2022-01-25 05:14:17 -05:00
|
|
|
el.querySelectorAll('[data-ol-async-form]').forEach(setup)
|
2021-09-27 06:45:04 -04:00
|
|
|
el.querySelectorAll('[data-ol-regular-form]').forEach(setup)
|
|
|
|
el.querySelectorAll('[data-ol-slow-link]').forEach(setup)
|
|
|
|
})
|