f3oall / awesome-notifications

Lightweight JavaScript Notifications Library
https://f3oall.github.io/awesome-notifications/
MIT License
286 stars 40 forks source link

close() and closeAll() methods #15

Closed f3oall closed 4 years ago

f3oall commented 5 years ago

Call of close() should close toast Call of closeAll() should close all toasts on the screen

Now there're only two ways to close toast: click on it and wait for end of duration.

If you think that you need a way to hide toasts programmatically, please vote for this issue. When this feature request will have enough votes, I will implement it.

This issue was firstly mentioned in #14.

f3oall commented 4 years ago

closeAll were implemented in v3.1.0 as closeToasts. Read docs to learn more.

There is no need for close method because all methods which show toasts return DOM element, so you can use native remove to hide it.

PS. Both closeToasts and native remove methods don't include hiding animation. Let me know if you need these methods implemented in way when they run animation of hiding.

manchumahara commented 1 year ago

If anyone is looking to close modal/popup manually

//init the modal
var my_modal = new AWN().modal(
    '<b>Custom modal window message</b><br>Class name: `awn-popup-modal-tiny`',
    'modal-tiny'
  );

//close/delete the modal
  my_modal.delete();