core-3nweb-client-lib 0.31.6 → 0.31.8

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.
@@ -45,7 +45,7 @@ function makeW3Nclient(clientSide, extraCAPs) {
45
45
  storage: storage_cap_ipc_1.makeStorageCaller,
46
46
  };
47
47
  const clientW3N = (0, generic_1.makeClientSide)(clientSide, mainCAPs, extraCAPs);
48
- addLogToConsoleIfNoCap(clientW3N);
48
+ addLogToConsoleToLogCap(clientW3N);
49
49
  return clientW3N;
50
50
  }
51
51
  async function promiseW3Nclient(clientSide, extraCAPs) {
@@ -56,37 +56,37 @@ async function promiseW3Nclient(clientSide, extraCAPs) {
56
56
  storage: storage_cap_ipc_1.promiseStorageCaller,
57
57
  };
58
58
  const clientW3N = await (0, generic_1.promiseClientSide)(clientSide, mainCAPs, extraCAPs);
59
- addLogToConsoleIfNoCap(clientW3N);
59
+ addLogToConsoleToLogCap(clientW3N);
60
60
  return clientW3N;
61
61
  }
62
- function addLogToConsoleIfNoCap(clientW3N) {
63
- if (!clientW3N.log) {
64
- clientW3N.log = async (type, msg, err) => {
65
- if (type === 'error') {
66
- if (err === undefined) {
67
- console.error(msg);
68
- }
69
- else {
70
- console.error(msg, err);
71
- }
62
+ function addLogToConsoleToLogCap(clientW3N) {
63
+ const logCap = clientW3N.log;
64
+ clientW3N.log = async (type, msg, err) => {
65
+ if (type === 'error') {
66
+ if (err === undefined) {
67
+ console.error(msg);
72
68
  }
73
- else if (type === 'warning') {
74
- if (err === undefined) {
75
- console.warn(msg);
76
- }
77
- else {
78
- console.warn(msg, err);
79
- }
69
+ else {
70
+ console.error(msg, err);
71
+ }
72
+ }
73
+ else if (type === 'warning') {
74
+ if (err === undefined) {
75
+ console.warn(msg);
76
+ }
77
+ else {
78
+ console.warn(msg, err);
79
+ }
80
+ }
81
+ else {
82
+ if (err === undefined) {
83
+ console.log(msg);
80
84
  }
81
85
  else {
82
- if (err === undefined) {
83
- console.log(msg);
84
- }
85
- else {
86
- console.log(msg, err);
87
- }
86
+ console.log(msg, err);
88
87
  }
89
- };
90
- }
88
+ }
89
+ await (logCap === null || logCap === void 0 ? void 0 : logCap(type, msg, err));
90
+ };
91
91
  }
92
92
  Object.freeze(exports);
@@ -220,8 +220,11 @@ class ClientsSideImpl {
220
220
  this.srvRefs.set(o, srvRef);
221
221
  }
222
222
  doOnClientObjDrop(srvRef) {
223
- this.weakSrvByRefs.delete(srvRef.path[0]);
224
- this.sendObjDropMsg(srvRef);
223
+ var _a;
224
+ if (!((_a = this.weakSrvByRefs.get(srvRef.path[0])) === null || _a === void 0 ? void 0 : _a.weakRef.deref())) {
225
+ this.weakSrvByRefs.delete(srvRef.path[0]);
226
+ this.sendObjDropMsg(srvRef);
227
+ }
225
228
  }
226
229
  sendObjDropMsg(srvRef) {
227
230
  if (this.isStopped) {