fix TypeScript types for AutoDismissFlash hook
This commit is contained in:
parent
1b4b7f1773
commit
b0d1c8d9b1
1 changed files with 4 additions and 2 deletions
|
|
@ -371,15 +371,17 @@ const ScrollToTop = {
|
|||
|
||||
// LiveView hook for auto-dismissing flash messages
|
||||
const AutoDismissFlash = {
|
||||
mounted() {
|
||||
timeout: null as ReturnType<typeof setTimeout> | null,
|
||||
mounted(this: any) {
|
||||
const dismissAfter = parseInt(this.el.dataset.dismissAfter || "30000", 10)
|
||||
this.timeout = setTimeout(() => {
|
||||
this.el.click()
|
||||
}, dismissAfter)
|
||||
},
|
||||
destroyed() {
|
||||
destroyed(this: any) {
|
||||
if (this.timeout) {
|
||||
clearTimeout(this.timeout)
|
||||
this.timeout = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue