Sha256: ee0c0e21862f3cde8a31c574db40c1c2e02d2270313e54bdbc2fb4b7b6081f14
Contents?: true
Size: 507 Bytes
Versions: 16
Compression:
Stored size: 507 Bytes
Contents
import { Turbo } from '@hotwired/turbo-rails' Turbo.config.forms.confirm = (message) => { const dialog = document.getElementById('turbo-confirm') dialog.querySelector('p').textContent = message dialog.showModal() dialog.addEventListener('click', (event) => { if (event.target.nodeName === 'DIALOG') { dialog.close() } }) return new Promise((resolve) => { dialog.addEventListener('close', () => { resolve(dialog.returnValue === 'confirm') }, { once: true }) }) }
Version data entries
16 entries across 16 versions & 1 rubygems