sciactive / pnotify

Beautiful JavaScript notifications with Web Notifications support.
https://sciactive.com/pnotify/
Apache License 2.0
3.65k stars 514 forks source link

destroy() not working? #380

Closed straycoders closed 4 years ago

straycoders commented 4 years ago

hi, I'm trying to avoid making use of history when using PNotify.alert(options). So, I want a simple warning message shown and nicely positioned using modal stack then closed by a single click, and destroyed. That's why I set options.{destroy:true}, which is; I guess; apparently not working as expected. Later I inspect console.log( PNotify.notices), the instance is still there. Is this really destroy() is not working or I've used it improperly?

straycoders commented 4 years ago

finally I managed to solve it. So sorry, I think I wasn't clear enough so my issue not easy to understand. Ok, I admit that I call the PNotify.alert() from within an event handler of another plugin (videojs-record) which is apparently conflicting with PNotify.

The exact location is:

player.on("deviceError", function() {
  // this line solves my problem
  player.record().destroy();

  // after that I call 
  PNotify.alert(options);
});

I hope this would help others who come accross the same situation.