nuxt-visitors 1.1.0 → 1.1.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 +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/app/composables/useVisitors.js +3 -2
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
@@ -10,7 +10,7 @@ const module = defineNuxtModule({
|
|
10
10
|
addImportsDir(resolver.resolve("./runtime/app/composables"));
|
11
11
|
addServerHandler({
|
12
12
|
route: "/.nuxt-visitors/ws",
|
13
|
-
handler: resolver.resolve("./runtime/server/routes/visitors
|
13
|
+
handler: resolver.resolve("./runtime/server/routes/visitors")
|
14
14
|
});
|
15
15
|
}
|
16
16
|
});
|
@@ -20,10 +20,11 @@ export function useVisitors() {
|
|
20
20
|
isConnected.value = false;
|
21
21
|
isLoading.value = false;
|
22
22
|
};
|
23
|
-
const handleMessage = (event) => {
|
23
|
+
const handleMessage = async (event) => {
|
24
24
|
if (!isMounted.value) return;
|
25
25
|
try {
|
26
|
-
const
|
26
|
+
const data = typeof event.data === "string" ? event.data : await event.data.text();
|
27
|
+
const visitorCount = parseInt(data, 10);
|
27
28
|
if (!isNaN(visitorCount) && visitorCount >= 0) {
|
28
29
|
visitors.value = visitorCount;
|
29
30
|
} else {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nuxt-visitors",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.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",
|
@@ -51,7 +51,7 @@
|
|
51
51
|
"changelogen": "^0.5.7",
|
52
52
|
"eslint": "^9.19.0",
|
53
53
|
"nuxt": "3.15.3",
|
54
|
-
"typescript": "5.
|
54
|
+
"typescript": "5.6.3",
|
55
55
|
"vitest": "^3.0.4",
|
56
56
|
"vue-tsc": "^2.2.0",
|
57
57
|
"automd": "^0.3.12"
|