question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add the ability to create elements using Bootstrap modules.

See original GitHub issue

Prerequisites

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:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
WinterSilencecommented, Feb 6, 2022

@ffoodd

wrap current classes in custom elements

not BC, I’m mean something like proxy pattern

0reactions
GeoSotcommented, Feb 8, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found