angelia.io 2.4.76 → 2.4.77

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.
Files changed (2) hide show
  1. package/client/index.js +9 -17
  2. package/package.json +1 -1
package/client/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  'use strict'
2
2
 
3
- const ClientWebWorker = `class ClientWebWorker {
3
+ class ClientWebWorker {
4
4
  constructor() {
5
- Blob.prototype.toJSON = function(){
5
+ Blob.prototype.toJSON = function () {
6
6
  return {
7
- b: new FileReaderSync().readAsDataURL(this)
7
+ b: new FileReaderSync().readAsDataURL(this),
8
8
  }
9
9
  }
10
- ArrayBuffer.prototype.toJSON = function(){
10
+ ArrayBuffer.prototype.toJSON = function () {
11
11
  return {
12
- a: new FileReaderSync().readAsDataURL(this)
12
+ a: new FileReaderSync().readAsDataURL(this),
13
13
  }
14
14
  }
15
15
 
@@ -50,10 +50,7 @@ const ClientWebWorker = `class ClientWebWorker {
50
50
  }
51
51
 
52
52
  connect(options) {
53
- if (
54
- this.reconnect &&
55
- (!this.io || this.io.readyState === WebSocket.CLOSED)
56
- ) {
53
+ if (this.reconnect && (!this.io || this.io.readyState === WebSocket.CLOSED)) {
57
54
  let url = new URL(options.url)
58
55
 
59
56
  // parms creation
@@ -68,12 +65,7 @@ const ClientWebWorker = `class ClientWebWorker {
68
65
  }
69
66
  url.search = Object.entries(params)
70
67
  .filter(([k, v]) => {
71
- return !(
72
- k === undefined ||
73
- k === null ||
74
- v === undefined ||
75
- v === null
76
- )
68
+ return !(k === undefined || k === null || v === undefined || v === null)
77
69
  })
78
70
  .map(([k, v]) => encodeURIComponent(k) + '=' + encodeURIComponent(v))
79
71
  .join('&')
@@ -222,7 +214,7 @@ const ClientWebWorker = `class ClientWebWorker {
222
214
  }
223
215
  return id
224
216
  }
225
- }`
217
+ }
226
218
 
227
219
  class Client {
228
220
  constructor(options) {
@@ -240,7 +232,7 @@ class Client {
240
232
  }
241
233
 
242
234
  const io = new Worker(
243
- URL.createObjectURL(new Blob(["'use strict';new (" + ClientWebWorker + ')']), {
235
+ URL.createObjectURL(new Blob(["'use strict';new (" + ClientWebWorker.toString() + ')']), {
244
236
  type: 'application/javascript; charset=utf-8',
245
237
  }),
246
238
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angelia.io",
3
- "version": "2.4.76",
3
+ "version": "2.4.77",
4
4
  "description": "WebSockets Server and Client API for node.js and the browser, with rooms support.",
5
5
  "homepage": "https://github.com/titoBouzout/angelia.io",
6
6
  "repository": {