@basmilius/apple-common 0.6.2 → 0.6.4

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/dist/index.js +7 -15
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -206,7 +206,6 @@ class Connection extends EventEmitter {
206
206
  }
207
207
  #address;
208
208
  #port;
209
- #bindings;
210
209
  #context;
211
210
  #debug = false;
212
211
  #retryAttempt = 0;
@@ -222,14 +221,6 @@ class Connection extends EventEmitter {
222
221
  this.#address = address;
223
222
  this.#port = port;
224
223
  this.#context = context;
225
- this.#bindings = {
226
- onClose: this.#onClose.bind(this),
227
- onConnect: this.#onConnect.bind(this),
228
- onData: this.#onData.bind(this),
229
- onEnd: this.#onEnd.bind(this),
230
- onError: this.#onError.bind(this),
231
- onTimeout: this.#onTimeout.bind(this)
232
- };
233
224
  this.#state = "disconnected";
234
225
  }
235
226
  async connect() {
@@ -290,14 +281,15 @@ class Connection extends EventEmitter {
290
281
  return new Promise((resolve, reject) => {
291
282
  this.#state = "connecting";
292
283
  this.#connectPromise = { resolve, reject };
284
+ this.#socket = undefined;
293
285
  this.#socket = new Socket;
294
286
  this.#socket.setTimeout(SOCKET_TIMEOUT);
295
- this.#socket.on("close", this.#bindings.onClose);
296
- this.#socket.on("connect", this.#bindings.onConnect);
297
- this.#socket.on("data", this.#bindings.onData);
298
- this.#socket.on("end", this.#bindings.onEnd);
299
- this.#socket.on("error", this.#bindings.onError);
300
- this.#socket.on("timeout", this.#bindings.onTimeout);
287
+ this.#socket.on("close", this.#onClose.bind(this));
288
+ this.#socket.on("connect", this.#onConnect.bind(this));
289
+ this.#socket.on("data", this.#onData.bind(this));
290
+ this.#socket.on("end", this.#onEnd.bind(this));
291
+ this.#socket.on("error", this.#onError.bind(this));
292
+ this.#socket.on("timeout", this.#onTimeout.bind(this));
301
293
  this.#context.logger.net(`Connecting to ${this.#address}:${this.#port}...`);
302
294
  this.#socket.connect({
303
295
  host: this.#address,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@basmilius/apple-common",
3
3
  "description": "Common features shared across various apple protocol packages.",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -25,7 +25,7 @@
25
25
  "provenance": true
26
26
  },
27
27
  "scripts": {
28
- "build": "tsc && bun -b build.ts",
28
+ "build": "tsgo && bun -b build.ts",
29
29
  "test:discovery": "bun --watch test-discovery.ts"
30
30
  },
31
31
  "main": "./dist/index.js",
@@ -39,13 +39,13 @@
39
39
  }
40
40
  },
41
41
  "dependencies": {
42
- "@basmilius/apple-encoding": "0.6.2",
43
- "@basmilius/apple-encryption": "0.6.2",
42
+ "@basmilius/apple-encoding": "0.6.4",
43
+ "@basmilius/apple-encryption": "0.6.4",
44
44
  "fast-srp-hap": "^2.0.4",
45
45
  "node-dns-sd": "^1.0.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@basmilius/tools": "^2.23.0",
48
+ "@basmilius/tools": "^2.24.0",
49
49
  "@types/bun": "^1.3.8",
50
50
  "uuid": "^13.0.0"
51
51
  }