Skip to content

Commit d1aff7e

Browse files
author
KHOUBZA Younes
committed
Add the ability to set persistent toasts if when timeout = 0
1 parent 12104c6 commit d1aff7e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/template.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,15 @@ export default class TemplateFactory implements FlasherInterface {
8383
break;
8484
}
8585

86+
template.addEventListener('click', () => {
87+
template.style.transform = 'scale(1.05)';
88+
setTimeout(() => {
89+
template.remove();
90+
}, 200);
91+
});
92+
8693
const progressBar = template.querySelector('.flasher-progress');
87-
if (progressBar instanceof HTMLElement) {
94+
if (progressBar instanceof HTMLElement && this.options.timeout > 0) {
8895
let width = 0;
8996
let progress: NodeJS.Timeout;
9097
const lapse = 1000 / this.options.fps;

0 commit comments

Comments
 (0)