Add the ability to create elements using Bootstrap modules.
See original GitHub issuePrerequisites
- I have searched for duplicate or closed feature requests
- I have read the contributing guidelines
Proposal
I would like the ability to create Bootstrap elements from the modules, for example, with the toast element:
const bootstrap = require('bootstrap');
const toastContainer = document.getElementById('toast-container');
...
catch (exception) {
// For clarity purposes in this proposal.
let title = 'Error';
let message = exception;
// Build the element using the module.
let toast = new bootstrap.Toast(title, message);
toast.iconUrl = './someIcon.png';
toast.timestamp = new Date();
toast.autoDestroyIn = 10000;
// Append the toast to the container.
toast.appendTo(toastContainer);
}
Auto-Destruction
This is not a requirement but would be a great feature if all modules implemented it so that we could specify that the element should be removed after so many milliseconds. By default, the element would live forever. I believe a very basic implementation would be something like:
if (this.autoDestroyIn)
setTimeout(destroy, this.autoDestroyIn);
Motivation and context
In Electron apps, it would be nice to generate elements such as toasts, list items, modals, etc within the preload and other renderer scripts. Currently, elements must be generated manually in a rather verbose way.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
JavaScript - Bootstrap
Bootstrap, a sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
Read more >Get started with Bootstrap · Bootstrap v5.2
Get started by including Bootstrap's production-ready CSS and JavaScript via CDN without the need for any build steps. See it in practice with...
Read more >JavaScript · Bootstrap v5.0
Bring Bootstrap to life with our optional JavaScript plugins. Learn about each plugin, our data and programmatic API options, and more.
Read more >Customize and download - Bootstrap
Customize Bootstrap's components, Less variables, and jQuery plugins to get your very own version. Requires IE9+ or latest Safari, Chrome, or Firefox. Have...
Read more >Introduction · Bootstrap v5.0
Looking to quickly add Bootstrap to your project? Use jsDelivr, a free open source CDN. Using a package manager or need to download...
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
@ffoodd
not BC, I’m mean something like proxy pattern
Probably you may try to propose your ideas, making a PR as a proof of concept. You never know, it may be liked out there. But please keep in mind to maintain a vital amount of backward compatibility. It may be a great overhead for many devs in order to keep their projects updated