Sha256: 480dac8420d9623484cb023e37fd1bb783560b9709ace112d2791310b538b2fc
Contents?: true
Size: 635 Bytes
Versions: 7
Compression:
Stored size: 635 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() { if (this.slimSelect) { 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
7 entries across 7 versions & 1 rubygems