Ability to add listeners directly to objects like Modals/Collapse/etc
See original GitHub issueHow about a public method to add listener(s) to an object, something like:
class Modal {
//...
on(event, callback) {
this._element.addEventListener(`${event}${EVENT_KEY}`, callback);
return this;
}
//...
}
This will allows us to do something like:
var myModal = new bootstrap.Modal(document.getElementById('myModal'));
myModal
.on('shown', function (e) {
// do something...
})
.on('hidden', function (e) {
// do something...
});
Instead of:
var myModal = new bootstrap.Modal(document.getElementById('myModal'));
myModal._element.addEventListener('shown.bs.modal', function (e) {
// do something...
});
myModal._element.addEventListener('hidden.bs.modal', function (e) {
// do something...
});
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:5 (4 by maintainers)
Top Results From Across the Web
[Modal] Adding tests · twbs/bootstrap@1591420 · GitHub
Ability to add listeners directly to objects like Modals/Collapse/etc Ability to add listeners directly to objects like Modals/Collapse/etc. CSS (node-sass) # ...
Read more >Multi-Modal Perception - Noba Project
Multimodal phenomena concern stimuli that generate simultaneous (or nearly simultaneous) information in more than one sensory modality. As discussed above, ...
Read more >Accessible Rich Internet Applications (WAI-ARIA) 1.1 - W3C
It clarifies semantics to assistive technologies when authors create new types of objects, via style and script, that are not yet directly ......
Read more >Menus - Android Developers
This method passes you the Menu object as it currently exists so you can modify it, such as add, remove, or disable items....
Read more >Fallacies | Internet Encyclopedia of Philosophy
That is, informal fallacies are errors of reasoning that cannot easily be expressed in our system of formal logic (such as symbolic, deductive,...
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 Free
Top 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

I would love if that supported chaining. E.g.
Hi @XhmikosR, i’ve created a PR: #32184