Sha256: b07a5801bec8a42318d59801918658696e4c7af76d870bf837b3a37eb33dcd80
Contents?: true
Size: 598 Bytes
Versions: 14
Compression:
Stored size: 598 Bytes
Contents
import { Controller } from "@hotwired/stimulus" // Connects to data-controller="slim-select" export default class extends Controller { connect() { this.slimSelect = new SlimSelect({ select: this.element }) this.element.setAttribute("data-action", "turbo:morph-element->slim-select#reconnect") } disconnect() { this.slimSelect.destroy() this.slimSelect = null } reconnect() { this.disconnect() // dispatch this on the next frame. // there's some funny issue where my elements get removed from the DOM setTimeout(() => this.connect(), 10) } }
Version data entries
14 entries across 14 versions & 1 rubygems