@basmilius/apple-devices 0.0.100 → 0.0.101

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.
@@ -13,8 +13,8 @@ export default class extends EventEmitter<EventMap> {
13
13
  get isConnected(): boolean;
14
14
  constructor(discoveryResult: DiscoveryResult);
15
15
  connect(): Promise<void>;
16
- disconnect(emit?: boolean): Promise<void>;
17
- disconnectSafely(emit?: boolean): Promise<void>;
16
+ disconnect(): Promise<void>;
17
+ disconnectSafely(): Promise<void>;
18
18
  setCredentials(credentials: AccessoryCredentials): Promise<void>;
19
19
  getAttentionState(): Promise<AttentionState>;
20
20
  getLaunchableApps(): Promise<LaunchableApp[]>;
package/dist/index.js CHANGED
@@ -1568,7 +1568,6 @@ class device_default extends EventEmitter2 {
1568
1568
  clearInterval(this.#feedbackInterval);
1569
1569
  await this.#unsubscribe();
1570
1570
  await this.#protocol.disconnect();
1571
- this.emit("disconnected", false);
1572
1571
  }
1573
1572
  async disconnectSafely() {
1574
1573
  try {
@@ -1596,7 +1595,7 @@ class device_default extends EventEmitter2 {
1596
1595
  return;
1597
1596
  }
1598
1597
  clearInterval(this.#feedbackInterval);
1599
- this.emit("disconnected", true);
1598
+ this.emit("disconnected", false);
1600
1599
  }
1601
1600
  async#onError(err) {
1602
1601
  reporter2.error("AirPlay error", err);
@@ -1704,18 +1703,15 @@ class device_default2 extends EventEmitter3 {
1704
1703
  await this.#setup();
1705
1704
  this.emit("connected");
1706
1705
  }
1707
- async disconnect(emit = true) {
1706
+ async disconnect() {
1708
1707
  this.#disconnect = true;
1709
1708
  clearInterval(this.#heartbeatInterval);
1710
1709
  await this.#unsubscribe();
1711
1710
  await this.#protocol.disconnect();
1712
- if (emit) {
1713
- this.emit("disconnected", false);
1714
- }
1715
1711
  }
1716
- async disconnectSafely(emit = true) {
1712
+ async disconnectSafely() {
1717
1713
  try {
1718
- await this.disconnect(emit);
1714
+ await this.disconnect();
1719
1715
  } catch (_) {}
1720
1716
  }
1721
1717
  async setCredentials(credentials) {
@@ -1757,16 +1753,16 @@ class device_default2 extends EventEmitter3 {
1757
1753
  return;
1758
1754
  }
1759
1755
  clearInterval(this.#heartbeatInterval);
1760
- this.emit("disconnected", true);
1756
+ this.emit("disconnected", false);
1761
1757
  }
1762
1758
  async#onError(err) {
1763
1759
  reporter3.error("Companion Link error", err);
1764
- await this.disconnectSafely(false);
1760
+ await this.disconnectSafely();
1765
1761
  this.emit("disconnected", true);
1766
1762
  }
1767
1763
  async#onTimeout() {
1768
1764
  reporter3.error("Companion Link timeout");
1769
- await this.disconnectSafely(false);
1765
+ await this.disconnectSafely();
1770
1766
  this.emit("disconnected", true);
1771
1767
  }
1772
1768
  async#setup() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@basmilius/apple-devices",
3
3
  "description": "Exposes various Apple devices to connect with either AirPlay or Companion Link.",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -43,10 +43,10 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@basmilius/apple-airplay": "0.0.100",
47
- "@basmilius/apple-common": "0.0.100",
48
- "@basmilius/apple-companion-link": "0.0.100",
49
- "@basmilius/apple-encoding": "0.0.100"
46
+ "@basmilius/apple-airplay": "0.0.101",
47
+ "@basmilius/apple-common": "0.0.101",
48
+ "@basmilius/apple-companion-link": "0.0.101",
49
+ "@basmilius/apple-encoding": "0.0.101"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@basmilius/tools": "^2.23.0",