Skip to content

Instantly share code, notes, and snippets.

View makrmark's full-sized avatar

Mark Cowlishaw makrmark

View GitHub Profile
@makrmark
makrmark / remote_modal_events_controller.js
Last active May 24, 2024 09:09
How to respond to Bootstrap (5) events from within Rails Stimulus Controller
import { Controller } from "@hotwired/stimulus"
import { Modal } from "bootstrap"
// Connects to data-controller="remote-modal-events"
export default class extends Controller {
connect() {
let thisController = this
// The listener for the Bootstrap event
this.element.addEventListener('hide.bs.modal', function (event) {