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);
}
Folks can now easily call a lightweight toast (a "snack") easily and if they wanted something more detailed they'd use the the $.toast function and pass the props as needed
The render function will handle generating the markup, this removes code duplication and makes it easier to make changes as it's all in one place
Global Options
I've implemented the ability to set global default options:
-This can be useful if you want consistent behaviour and don't want to mess with these options on every toast/snack
Although it's called toastDefaults these options will be used for snacks too so If someone has a more generic name for it, please say
If you think anything should be globalised then please say
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
I'm hoping to have this version completed next weekend (maybe earlier, but, this is tentative)
This issue will remain open until then so post any feedback before it's closed
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:$.toast
function and pass the props as neededGlobal Options
I've implemented the ability to set global default options:
-This can be useful if you want consistent behaviour and don't want to mess with these options on every toast/snack
toastDefaults
these options will be used for snacks too so If someone has a more generic name for it, please sayDevelopment
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