Multi event actions
See original GitHub issueHey,
In one of my apps I had a problem that I needed few events to trigger the same input action.
It looked like paste->changeThings input->changeThings
.
I think it would be nice to have a map between multiple events and an action like paste,input->changeThings
.
Would this make sense as an addition to stimulus?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Developing the Multi-Event Athlete - SimpliFaster
The multi events in track & field—which consist of the decathlon, heptathlon, and pentathlon—provide coaches and athletes with a unique set of circumstances ......
Read more >Multi-sport event - Wikipedia
A multi-sport event is an organized sporting event, often held over multiple days, featuring competition in many different sports among organized teams of ......
Read more >Managing Events and Actions in Advanced View
Using events and event actions in Map Editor, you can: • Receive notifications from the ... For multi-mode connector actions, see Multimode Event...
Read more >Triggering a workflow - GitHub AE Docs
How to automatically trigger GitHub Actions workflows. ... Workflow triggers are events that cause a workflow to run. These events can be:.
Read more >Event Action, Definition - Infor Documentation
A single event handler can have multiple event actions. Depending on its action type, an event action can do such things as: Evaluate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://stimulus.hotwired.dev/reference/actions#multiple-actions
I don’t think the complexity of implementing multi event-type in the framework and explaining the new syntax in the docs is worth the value for the few times when you need to listen to several event types with the same action.
In the three examples given, it seems to me that using the default event type for input elements (aka
input
) would probably cover all cases (paste, change, keyup, blur and focus).Hey @dvisockas @stillhart @kieraneglin
If you’re still interested in a solution, there are two ways to achieve it. The core idea is to mix the events create a custom event and dispatch it to the element.
Method 1: Use a helper to mix events in the controller
https://jsfiddle.net/frayzil/1ebfmgk7/8/
The HTML
The Controller
The Helper
2. Use a controller to mix events in the HTML
https://jsfiddle.net/frayzil/1ebfmgk7/13/
The HTML
The EventsMixerController