Script47 / Toast

A Bootstrap 4.2+ jQuery plugin for the toast component
https://shrtn.onl/EY
MIT License
152 stars 43 forks source link

v1.0.0 #23

Closed Script47 closed 4 years ago

Script47 commented 4 years ago

Folks,

It may seem as though I've been ignoring the issues/PRs but things have been hectic IRL. However, I've been taking some time out this past week - and hopefully, the coming week too - to cleanup and make changes to this little plugin.

I'm going to run over some things that I've changed and would like to here your thoughts (positive and negative, of course).

Let's get to it.

Code Restructure

Previously, we simply had $.toast which was the entry point for the plugin, now, we have two functions $.toast and $.snack. This is how they'll look:

/**
 * Show a snack
 * @param title
 * @param type
 * @param delay
 */
$.snack = function (title, type, delay) {
    return render({
        title,
        type,
        delay
    });
}

/**
 * Show a toast
 * @param opts
 */
$.toast = function (opts) {
    return render(opts);
}

Global Options

I've implemented the ability to set global default options:

$.toastDefaults = {
    dismissible: true,
    stackable: true
};

-This can be useful if you want consistent behaviour and don't want to mess with these options on every toast/snack

Development

As people have adapted this plugin and suggested changes, I've been trying to make it easier from the perspective of forkers. I've added babel as a dev dependency. For now, it simply transpiles the code to ES5. Eventually, I'll get it to minify the code too.

Miscellaneous