nuxt-skew-protection 0.1.3 → 0.1.4
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/dist/module.json
CHANGED
|
@@ -11,6 +11,7 @@ const skewProtection = useSkewProtection();
|
|
|
11
11
|
const chunksOutdated = ref(false);
|
|
12
12
|
const appOutdated = ref(false);
|
|
13
13
|
const outdatedPayload = ref(null);
|
|
14
|
+
const dismissed = ref(false);
|
|
14
15
|
skewProtection.onCurrentChunksOutdated((payload) => {
|
|
15
16
|
chunksOutdated.value = true;
|
|
16
17
|
outdatedPayload.value = payload;
|
|
@@ -19,23 +20,30 @@ skewProtection.onAppOutdated(() => {
|
|
|
19
20
|
appOutdated.value = true;
|
|
20
21
|
});
|
|
21
22
|
const isCurrentChunksOutdated = computed(() => {
|
|
23
|
+
if (dismissed.value)
|
|
24
|
+
return false;
|
|
22
25
|
if (props.forceOpen)
|
|
23
26
|
return true;
|
|
24
27
|
return chunksOutdated.value;
|
|
25
28
|
});
|
|
26
29
|
const isAppOutdated = computed(() => {
|
|
30
|
+
if (dismissed.value)
|
|
31
|
+
return false;
|
|
27
32
|
if (props.forceOpen)
|
|
28
33
|
return true;
|
|
29
34
|
return appOutdated.value;
|
|
30
35
|
});
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
const releaseTimestamp = computed(() => {
|
|
37
|
+
if (props.forceOpen)
|
|
38
|
+
return Date.now() - 5 * 60 * 1e3;
|
|
39
|
+
return skewProtection.manifest.value?.timestamp ?? Date.now();
|
|
34
40
|
});
|
|
35
|
-
const
|
|
41
|
+
const releaseDate = computed(() => new Date(releaseTimestamp.value));
|
|
42
|
+
const timeAgo = useTimeAgo(releaseTimestamp, {
|
|
36
43
|
showSecond: true
|
|
37
44
|
});
|
|
38
45
|
function handleDismiss() {
|
|
46
|
+
dismissed.value = true;
|
|
39
47
|
chunksOutdated.value = false;
|
|
40
48
|
emit("dismiss");
|
|
41
49
|
}
|