@camera.ui/browser 0.0.141 → 0.0.142
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/index.js +17 -4
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1956,9 +1956,12 @@ var log$2 = new Logger("plugin");
|
|
|
1956
1956
|
function isContext(input) {
|
|
1957
1957
|
return "rpc" in input && "isConnected" in input;
|
|
1958
1958
|
}
|
|
1959
|
+
var DOWN_DEBOUNCE_MS = 4e3;
|
|
1959
1960
|
function makeContextFromTransport(input) {
|
|
1960
1961
|
const { natsTransport, target, wsTransport } = input;
|
|
1961
1962
|
let hasBeenConnected = natsTransport.getClient() !== null;
|
|
1963
|
+
let lastClient = natsTransport.getClient();
|
|
1964
|
+
let downTimer = null;
|
|
1962
1965
|
const rpc = shallowRef(natsTransport.getClient() ?? void 0);
|
|
1963
1966
|
const isConnected = ref(natsTransport.getClient()?.isConnected ?? false);
|
|
1964
1967
|
const error = ref(void 0);
|
|
@@ -1991,20 +1994,30 @@ function makeContextFromTransport(input) {
|
|
|
1991
1994
|
}
|
|
1992
1995
|
}
|
|
1993
1996
|
natsTransport.subscribeClient((next) => {
|
|
1994
|
-
const wasConnected = isConnected.value;
|
|
1995
1997
|
if (next) {
|
|
1998
|
+
if (downTimer !== null) {
|
|
1999
|
+
clearTimeout(downTimer);
|
|
2000
|
+
downTimer = null;
|
|
2001
|
+
}
|
|
2002
|
+
const wasConnected = isConnected.value;
|
|
2003
|
+
const clientChanged = next !== lastClient;
|
|
2004
|
+
lastClient = next;
|
|
1996
2005
|
rpc.value = next;
|
|
1997
2006
|
isConnected.value = true;
|
|
1998
2007
|
error.value = void 0;
|
|
1999
|
-
if (!wasConnected) {
|
|
2008
|
+
if (!wasConnected || clientChanged) {
|
|
2000
2009
|
refreshClientSubscriptions();
|
|
2001
2010
|
if (hasBeenConnected) emit("reconnected");
|
|
2002
2011
|
hasBeenConnected = true;
|
|
2003
2012
|
}
|
|
2004
2013
|
} else {
|
|
2005
2014
|
rpc.value = void 0;
|
|
2006
|
-
isConnected.value
|
|
2007
|
-
|
|
2015
|
+
if (downTimer !== null || !isConnected.value) return;
|
|
2016
|
+
downTimer = setTimeout(() => {
|
|
2017
|
+
downTimer = null;
|
|
2018
|
+
isConnected.value = false;
|
|
2019
|
+
emit("disconnected");
|
|
2020
|
+
}, DOWN_DEBOUNCE_MS);
|
|
2008
2021
|
}
|
|
2009
2022
|
});
|
|
2010
2023
|
natsTransport.on("auth-error", (payload) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.142",
|
|
4
4
|
"description": "camera.ui browser client",
|
|
5
5
|
"author": "seydx (https://github.com/cameraui/clients)",
|
|
6
6
|
"type": "module",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@camera.ui/logger": ">=0.0.2",
|
|
33
|
-
"@camera.ui/rpc": ">=1.0.
|
|
33
|
+
"@camera.ui/rpc": ">=1.0.10",
|
|
34
34
|
"@camera.ui/sdk": ">=0.0.29",
|
|
35
35
|
"@camera.ui/transport": ">=0.0.1",
|
|
36
36
|
"@vueuse/core": ">=14.3.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@camera.ui/logger": "file:../../packages/logger",
|
|
41
|
-
"@camera.ui/rpc": "^1.0.
|
|
41
|
+
"@camera.ui/rpc": "^1.0.10",
|
|
42
42
|
"@camera.ui/sdk": "~0.0.29",
|
|
43
43
|
"@camera.ui/transport": "file:../../packages/transport",
|
|
44
44
|
"@eneris/push-receiver": "^4.3.1",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
50
50
|
"@vue/eslint-config-prettier": "^10.2.0",
|
|
51
51
|
"@vue/eslint-config-typescript": "^14.9.0",
|
|
52
|
-
"@vue/language-core": "^3.3.
|
|
52
|
+
"@vue/language-core": "^3.3.8",
|
|
53
53
|
"@vue/tsconfig": "^0.9.1",
|
|
54
54
|
"@vueuse/core": "^14.3.0",
|
|
55
55
|
"@webgpu/types": "^0.1.71",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"vite": "^8.1.5",
|
|
66
66
|
"vitest": "^4.1.10",
|
|
67
67
|
"vue": "^3.5.40",
|
|
68
|
-
"vue-tsc": "^3.3.
|
|
68
|
+
"vue-tsc": "^3.3.8"
|
|
69
69
|
},
|
|
70
70
|
"overrides": {
|
|
71
71
|
"@vue/language-core": "$@vue/language-core"
|