@fy-/fws-vue 2.3.42 → 2.3.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -61,18 +61,19 @@ const onCall = useDebounceFn((data: NotifProps) => {
|
|
|
61
61
|
else if (data.type === 'secret') data.imgIcon = SparklesIcon
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
// Set the new notification
|
|
64
|
+
// Set the new notification with default time of 2000ms (2 seconds) if not specified
|
|
65
65
|
currentNotif.value = {
|
|
66
66
|
...data,
|
|
67
|
+
time: data.time || 2000, // Set default to 2 seconds if not specified
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
// (A) Hide the notification after the specified time
|
|
70
|
-
hideTimeout = setTimeout(() => hideNotif(),
|
|
71
|
+
hideTimeout = setTimeout(() => hideNotif(), currentNotif.value.time)
|
|
71
72
|
|
|
72
73
|
// (B) Use requestAnimationFrame for smoother animation
|
|
73
74
|
progress.value = 0
|
|
74
75
|
const startTime = performance.now()
|
|
75
|
-
const duration = Number(
|
|
76
|
+
const duration = Number(currentNotif.value.time)
|
|
76
77
|
|
|
77
78
|
const { pause } = useRafFn((timestamp) => {
|
|
78
79
|
if (isPaused.value) return
|
|
@@ -132,7 +133,7 @@ function resumeTimer() {
|
|
|
132
133
|
// Calculate remaining time based on progress
|
|
133
134
|
const remainingTime = currentNotif.value.time
|
|
134
135
|
? Math.max(currentNotif.value.time * (1 - progress.value / 100), 1000)
|
|
135
|
-
:
|
|
136
|
+
: 2000 // Default to 2 seconds
|
|
136
137
|
|
|
137
138
|
// Reset the timeout with the remaining time
|
|
138
139
|
hideTimeout = setTimeout(() => hideNotif(), remainingTime)
|