nuxt-visitors 1.2.0 → 1.2.1
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/README.md
CHANGED
@@ -127,10 +127,10 @@ To start contributing, you can follow these steps:
|
|
127
127
|
## Sponsors
|
128
128
|
|
129
129
|
<p align="center">
|
130
|
-
<a href="https://
|
130
|
+
<a href="https://github.com/sponsors/HugoRCD">
|
131
131
|
<img src='https://cdn.jsdelivr.net/gh/hugorcd/static/sponsors.svg' alt="HugoRCD sponsors" />
|
132
132
|
</a>
|
133
|
-
</p>
|
133
|
+
</p>
|
134
134
|
|
135
135
|
<!-- /automd -->
|
136
136
|
|
@@ -151,6 +151,6 @@ Made by [@HugoRCD](https://github.com/HugoRCD) and [community](https://github.co
|
|
151
151
|
|
152
152
|
---
|
153
153
|
|
154
|
-
_🤖 auto updated with [automd](https://automd.unjs.io) (last updated:
|
154
|
+
_🤖 auto updated with [automd](https://automd.unjs.io) (last updated: Tue Apr 15 2025)_
|
155
155
|
|
156
156
|
<!-- /automd -->
|
package/dist/module.json
CHANGED
@@ -31,12 +31,12 @@ export function useVisitors() {
|
|
31
31
|
if (!isMounted.value) return;
|
32
32
|
try {
|
33
33
|
const data = typeof event.data === "string" ? event.data : await event.data.text();
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
const payload = JSON.parse(data);
|
35
|
+
if (!Array.isArray(payload) && !isNaN(payload) && payload >= 0) {
|
36
|
+
visitors.value = payload;
|
37
|
+
} else if (Array.isArray(payload)) {
|
38
|
+
locations.value = payload;
|
39
|
+
visitors.value = payload.length;
|
40
40
|
}
|
41
41
|
} catch (err) {
|
42
42
|
console.error("Failed to parse visitors WebSocket data:", err);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nuxt-visitors",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.1",
|
4
4
|
"description": "Add real-time visitor tracking to your Nuxt app with one line of code. WebSocket made easy",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"type": "module",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"ufo": "^1.6.1"
|
42
42
|
},
|
43
43
|
"devDependencies": {
|
44
|
-
"@hrcd/eslint-config": "
|
44
|
+
"@hrcd/eslint-config": "^3.0.3",
|
45
45
|
"@nuxt/devtools": "^2.4.0",
|
46
46
|
"@nuxt/module-builder": "^1.0.1",
|
47
47
|
"@nuxt/schema": "3.16.2",
|