aloha-vue 1.0.269 → 1.0.271
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.
package/package.json
CHANGED
|
@@ -15,29 +15,6 @@ const notifications = computed(() => {
|
|
|
15
15
|
let notificationsCount = 0;
|
|
16
16
|
|
|
17
17
|
export default function ANotificationAPI() {
|
|
18
|
-
const removeNotification = notificationIndex => {
|
|
19
|
-
if (notificationsObj.value[notificationIndex]) {
|
|
20
|
-
delete notificationsObj.value[notificationIndex];
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const addNotification = ({ text, type = "success", timeout }) => {
|
|
25
|
-
const TIMEOUT_LOCAL = timeout || notificationTimeout;
|
|
26
|
-
const CURRENT_INDEX = notificationsCount;
|
|
27
|
-
notificationsObj.value[CURRENT_INDEX] = {
|
|
28
|
-
text,
|
|
29
|
-
type,
|
|
30
|
-
index: CURRENT_INDEX,
|
|
31
|
-
};
|
|
32
|
-
notificationsCount++;
|
|
33
|
-
|
|
34
|
-
if (TIMEOUT_LOCAL) {
|
|
35
|
-
setTimeout(() => {
|
|
36
|
-
removeNotification(CURRENT_INDEX);
|
|
37
|
-
}, TIMEOUT_LOCAL);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
18
|
const setNotificationTimeout = timeout => {
|
|
42
19
|
notificationTimeout = timeout;
|
|
43
20
|
};
|
|
@@ -49,3 +26,26 @@ export default function ANotificationAPI() {
|
|
|
49
26
|
setNotificationTimeout,
|
|
50
27
|
};
|
|
51
28
|
}
|
|
29
|
+
|
|
30
|
+
export function addNotification({ text, type = "success", timeout }) {
|
|
31
|
+
const TIMEOUT_LOCAL = timeout || notificationTimeout;
|
|
32
|
+
const CURRENT_INDEX = notificationsCount;
|
|
33
|
+
notificationsObj.value[CURRENT_INDEX] = {
|
|
34
|
+
text,
|
|
35
|
+
type,
|
|
36
|
+
index: CURRENT_INDEX,
|
|
37
|
+
};
|
|
38
|
+
notificationsCount++;
|
|
39
|
+
|
|
40
|
+
if (TIMEOUT_LOCAL) {
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
removeNotification(CURRENT_INDEX);
|
|
43
|
+
}, TIMEOUT_LOCAL);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function removeNotification(notificationIndex) {
|
|
48
|
+
if (notificationsObj.value[notificationIndex]) {
|
|
49
|
+
delete notificationsObj.value[notificationIndex];
|
|
50
|
+
}
|
|
51
|
+
}
|