@notask/unity-cli-tools 1.1.1 → 1.1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.1.2](https://github.com/NoTaskStudios/unity-cli-tools/compare/1.1.1...1.1.2) (2025-05-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **hot-fix:** completed promise as get ([22f152a](https://github.com/NoTaskStudios/unity-cli-tools/commit/22f152a5da016371719649593a96005a636fa9c5))
7
+
1
8
  ## [1.1.1](https://github.com/NoTaskStudios/unity-cli-tools/compare/1.1.0...1.1.1) (2025-05-04)
2
9
 
3
10
 
@@ -9,11 +9,30 @@ class UnityHubInstallerEvent extends events_1.EventEmitter {
9
9
  constructor() {
10
10
  super();
11
11
  }
12
- completed = new Promise((resolve, reject) => {
13
- this.on(unity_ts_1.InstallerEventType.Completed, (events) => resolve(events));
14
- this.on(unity_ts_1.InstallerEventType.Error, (error) => reject(error));
15
- this.on(unity_ts_1.InstallerEventType.Cancelled, (events) => reject(new Error("Cancelled")));
16
- });
12
+ get completed() {
13
+ return new Promise((resolve, reject) => {
14
+ const onComplete = (events) => {
15
+ cleanup();
16
+ resolve(events);
17
+ };
18
+ const onError = (error) => {
19
+ cleanup();
20
+ reject(error);
21
+ };
22
+ const onCancel = () => {
23
+ cleanup();
24
+ reject(new Error("Cancelled"));
25
+ };
26
+ const cleanup = () => {
27
+ this.off(unity_ts_1.InstallerEventType.Completed, onComplete);
28
+ this.off(unity_ts_1.InstallerEventType.Error, onError);
29
+ this.off(unity_ts_1.InstallerEventType.Cancelled, onCancel);
30
+ };
31
+ this.on(unity_ts_1.InstallerEventType.Completed, onComplete);
32
+ this.on(unity_ts_1.InstallerEventType.Error, onError);
33
+ this.on(unity_ts_1.InstallerEventType.Cancelled, onCancel);
34
+ });
35
+ }
17
36
  Progress(raw) {
18
37
  const events = hubEventParser_ts_1.UnityHubEventParser.parseUnityHubEvent(raw);
19
38
  if (events.length === 0)
@@ -14,7 +14,7 @@ export interface InstallerEmitter extends EventEmitter {
14
14
  export declare class UnityHubInstallerEvent extends EventEmitter implements InstallerEmitter {
15
15
  #private;
16
16
  constructor();
17
- completed: Promise<InstallerEvent[]>;
17
+ get completed(): Promise<InstallerEvent[]>;
18
18
  Progress(raw: string): void;
19
19
  Cancel(): void;
20
20
  }
@@ -6,11 +6,30 @@ export class UnityHubInstallerEvent extends EventEmitter {
6
6
  constructor() {
7
7
  super();
8
8
  }
9
- completed = new Promise((resolve, reject) => {
10
- this.on(InstallerEventType.Completed, (events) => resolve(events));
11
- this.on(InstallerEventType.Error, (error) => reject(error));
12
- this.on(InstallerEventType.Cancelled, (events) => reject(new Error("Cancelled")));
13
- });
9
+ get completed() {
10
+ return new Promise((resolve, reject) => {
11
+ const onComplete = (events) => {
12
+ cleanup();
13
+ resolve(events);
14
+ };
15
+ const onError = (error) => {
16
+ cleanup();
17
+ reject(error);
18
+ };
19
+ const onCancel = () => {
20
+ cleanup();
21
+ reject(new Error("Cancelled"));
22
+ };
23
+ const cleanup = () => {
24
+ this.off(InstallerEventType.Completed, onComplete);
25
+ this.off(InstallerEventType.Error, onError);
26
+ this.off(InstallerEventType.Cancelled, onCancel);
27
+ };
28
+ this.on(InstallerEventType.Completed, onComplete);
29
+ this.on(InstallerEventType.Error, onError);
30
+ this.on(InstallerEventType.Cancelled, onCancel);
31
+ });
32
+ }
14
33
  Progress(raw) {
15
34
  const events = UnityHubEventParser.parseUnityHubEvent(raw);
16
35
  if (events.length === 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notask/unity-cli-tools",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/esm/index.d.ts",