@jcbuisson/express-x-client 2.2.1 → 2.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcbuisson/express-x-client",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "type": "module",
5
5
  "description": "Client library for ExpressX framework",
6
6
  "main": "src/index.mjs",
package/src/index.mjs CHANGED
@@ -22,21 +22,21 @@ export default function expressXClient(socket, options={}) {
22
22
  let errorListeners = []
23
23
 
24
24
  socket.on("connect", async () => {
25
- console.log("socket connected", socket.id)
25
+ if (options.debug) console.log("socket connected", socket.id)
26
26
  for (const func of connectListeners) {
27
27
  func(socket)
28
28
  }
29
29
  })
30
30
 
31
31
  socket.on("connect_error", async (err) => {
32
- console.log("socket connection error", socket.id)
32
+ if (options.debug) console.log("socket connection error", socket.id)
33
33
  for (const func of errorListeners) {
34
34
  func(socket)
35
35
  }
36
36
  })
37
37
 
38
38
  socket.on("disconnect", async () => {
39
- console.log("socket disconnected", socket.id)
39
+ if (options.debug) console.log("socket disconnected", socket.id)
40
40
  for (const func of disconnectListeners) {
41
41
  func(socket)
42
42
  }
@@ -141,14 +141,12 @@ export default function expressXClient(socket, options={}) {
141
141
  if (options.debug) console.log('app-event', type, value)
142
142
  if (!type2appHandler[type]) type2appHandler[type] = {}
143
143
  const handler = type2appHandler[type]
144
- console.log('handler', handler)
145
144
  if (handler) handler(value)
146
145
  })
147
146
 
148
147
  // add a handler for application-wide events
149
148
  function on(type, handler) {
150
149
  type2appHandler[type] = handler
151
- console.log('type2appHandler[type]', type2appHandler[type])
152
150
  }
153
151
 
154
152
  return {
@@ -1,18 +0,0 @@
1
- {
2
- // Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
3
- // Pointez pour afficher la description des attributs existants.
4
- // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "type": "node",
9
- "request": "launch",
10
- "name": "test",
11
- "skipFiles": [
12
- "<node_internals>/**"
13
- ],
14
- "cwd": "${workspaceFolder}",
15
- "program": "${workspaceFolder}/test/index.test.js"
16
- }
17
- ]
18
- }