UNPKG

alpine-turbo-drive-adapter

Version:

Bridge library to enable full support for Alpine components in pages using Turbolinks/Turbo Drive

16 lines (12 loc) 470 B
import Bridge from './bridge' if (window.Alpine) { console.error('Alpine-turbo-drive-adapter must be included before AlpineJs') } // Polyfill for legacy browsers if (!Object.getOwnPropertyDescriptor(NodeList.prototype, 'forEach')) { Object.defineProperty(NodeList.prototype, 'forEach', Object.getOwnPropertyDescriptor(Array.prototype, 'forEach')) } document.addEventListener('alpine:init', () => { const bridge = new Bridge() bridge.init() }, { once: true })