jackbsteinberg / std-toast

120 stars 4 forks source link

Document toast lifecycle and interactions with DOM #15

Open fergald opened 5 years ago

fergald commented 5 years ago

With the showToast API, I should be able to do

showToast(...);

and have a toast appear for a time, then disappear and everything gets garbage collected. I do not end up with a sitting in my DOM forever. However

var toast;
...
toast = showToast(...);

should give me an object that I can show/hide over and over. I think this implies that a showToast-created toast should insert/remove itself from the DOM as it's shown/hidden. What about a toast that is naturally in the DOM? It seems like it shouldn't pop in and out of the DOM on show/hide since the DOM may be the only reference to it.