I have a single-file Javascript soundboard application from app academy. The code works fine, but how do I “wire” it into the Rails 7 server? I’m struggling to bridge my understanding between frontend javascript and backend Rails. It runs if I paste the contents into app/javascript/application.js but I want to keep it a separate file: ‘app/javascript/soundboard/soundboard.js’ I am starting from
Tag: stimulusjs
Stimulus.js call method defined in connect() lifecycle callback
Im still learning stimulus.js and I’m trying to expand on the DriftingRuby episode on stimulusJS and FullCalendar. In that tutorial the form submits a normal http put request and the page is reloaded. I’d like to allow users to manage events using UJS/Stimulus and not requiring a page reload. This is my calendar_controller.js I need to call the add_event method
Stimulus controller: event listened multiple times; how do I remove event listeners and retain the Context?
I’ve got the following controller on my HTML page: This child controller is mapped to the following child_controller.js class: As you can see, there is an event listener on the connect() of the Stimulus controller, and when it detects that the event was fired up, it logs the event and manipulates the span target. The problem arises when I replace