我正在使用Toastr通知,并尝试在通知出现、消失或手动关闭时执行某些操作。我真的不确定该怎么做……我已经看到开发人员在这里简要地解释过了:https://github.com/CodeSeven/toastr/issues/88
但我是JS的新手,不知道该怎么做。提前感谢!
编辑:
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": false,
"progressBar": true,
"positionClass": "toast-top-full-width",
"preventDuplicates": false,
"showDuration": "1000",
"hideDuration": "1000",
"timeOut": "0",
"extendedTimeOut": "0",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "slideDown",
"hideMethod": "slideUp"
}
toastr.success("New Order");
var playAudio = true;
var audio = new Audio('notificationSound.mp3');
while (playAudio) {
audio.play();
}
我希望音频开始时,通知出现,并保持循环,直到它关闭。
发布于 2018-08-13 22:14:33
每当上述任何事件发生时,都会触发toastr.subscribe();
。如果您希望在每次发生这种情况时都将某些内容记录到控制台,请使用
toastr.subscribe(() = > {
console.log("logged something");
});
想要访问有关该事件的信息吗?
toastr.subscribe((...args) = > {
console.log(args);
});
args
变量保存有关事件的信息。
https://stackoverflow.com/questions/51831200
复制相似问题