Is there a way to detect when a UIKit notification has been closed?
The UIkit notification plugin () mentions that it has a close event. Can this be utilized for notifications triggered programmatically as shown below?
e.g.
UIkit.notification({
message: 'my-message!',
status: 'primary',
timeout: null
});
UIKit.o
I attempted to store the notification in a variable following suggestions from , but the return value was undefined:
let foo = UIkit.notification('message'); // foo is undefined
Furthermore, I tried using the chaining method with the on function:
UIkit.notification.on('close', function() { ... }); // on is undefined
However, the .on
method belongs to UIkit.util.on($el, event, fn)
, and since there is no $el
when invoking notification programatically, this approach did not work.
The only alternative solution I can think of is to implement a mutation observer on the body element and monitor changes to the notification element's state, although this seems like an excessive measure.