@vived/app 3.1.0 → 3.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.
@@ -3,6 +3,7 @@ import { AppObjectComponent } from "./AppObjectComponent";
3
3
  import { AppObjectRepo } from "./AppObjectRepo";
4
4
  export declare abstract class AppObject extends ObservableEntity {
5
5
  abstract readonly id: string;
6
+ abstract readonly repo: AppObjectRepo;
6
7
  abstract get enabled(): boolean;
7
8
  abstract set enabled(val: boolean);
8
9
  abstract hasComponent(type: string): boolean;
@@ -12,7 +12,6 @@ exports.makeAppObject = makeAppObject;
12
12
  class AppObjectImp extends AppObject {
13
13
  constructor(id, repo) {
14
14
  super();
15
- this.repo = repo;
16
15
  this.memoizedEnabled = new Entities_1.MemoizedBoolean(true, this.notify);
17
16
  this.componentLookup = new Map();
18
17
  this.dispose = () => {
@@ -24,6 +23,7 @@ class AppObjectImp extends AppObject {
24
23
  }
25
24
  };
26
25
  this.id = id;
26
+ this.repo = repo;
27
27
  this.repo.add(this);
28
28
  }
29
29
  get enabled() {
@@ -7,9 +7,9 @@ export declare abstract class AppObjectPM<T> implements AppObjectComponent {
7
7
  private _lastVM?;
8
8
  get lastVM(): T | undefined;
9
9
  private observerList;
10
- addView: (updateView: (vm: T) => void) => void;
11
- removeView: (updateView: (vm: T) => void) => void;
12
- doUpdateView: (vm: T) => void;
10
+ addView(updateView: (vm: T) => void): void;
11
+ removeView(updateView: (vm: T) => void): void;
12
+ doUpdateView(vm: T): void;
13
13
  dispose(): void;
14
14
  constructor(appObject: AppObject, type: string);
15
15
  }
@@ -5,22 +5,6 @@ const Entities_1 = require("../Entities");
5
5
  class AppObjectPM {
6
6
  constructor(appObject, type) {
7
7
  this.observerList = new Entities_1.ObserverList();
8
- this.addView = (updateView) => {
9
- this.observerList.add(updateView);
10
- if (this._lastVM) {
11
- updateView(this._lastVM);
12
- }
13
- };
14
- this.removeView = (updateView) => {
15
- this.observerList.remove(updateView);
16
- };
17
- this.doUpdateView = (vm) => {
18
- if (this._lastVM && this.vmsAreEqual(this._lastVM, vm)) {
19
- return;
20
- }
21
- this._lastVM = vm;
22
- this.observerList.notify(vm);
23
- };
24
8
  this.type = type;
25
9
  this.appObject = appObject;
26
10
  appObject.addComponent(this);
@@ -28,6 +12,25 @@ class AppObjectPM {
28
12
  get lastVM() {
29
13
  return this._lastVM;
30
14
  }
15
+ addView(updateView) {
16
+ this.observerList.add(updateView);
17
+ if (this._lastVM) {
18
+ updateView(this._lastVM);
19
+ }
20
+ }
21
+ ;
22
+ removeView(updateView) {
23
+ this.observerList.remove(updateView);
24
+ }
25
+ ;
26
+ doUpdateView(vm) {
27
+ if (this._lastVM && this.vmsAreEqual(this._lastVM, vm)) {
28
+ return;
29
+ }
30
+ this._lastVM = vm;
31
+ this.observerList.notify(vm);
32
+ }
33
+ ;
31
34
  dispose() {
32
35
  this.observerList.clear();
33
36
  if (this.appObject.getComponent(this.type) === this) {
@@ -13,6 +13,7 @@ class IsHiddenPM extends AppObjectPM_1.AppObjectPM {
13
13
  };
14
14
  this.dispose = () => {
15
15
  var _a, _b;
16
+ super.dispose();
16
17
  (_a = this.hideable) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onIsHiddenChange);
17
18
  (_b = this.hideable) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
18
19
  };
@@ -23,7 +24,7 @@ class IsHiddenPM extends AppObjectPM_1.AppObjectPM {
23
24
  }
24
25
  else {
25
26
  this.hideable.addChangeObserver(this.onIsHiddenChange);
26
- this.hideable.addOnDisposeObserver(() => this.dispose());
27
+ this.hideable.addOnDisposeObserver(this.dispose);
27
28
  this.onIsHiddenChange();
28
29
  }
29
30
  }
@@ -28,7 +28,7 @@ class LabelPM extends AppObject_1.AppObjectPM {
28
28
  this.label = Label_1.Label.get(appObject);
29
29
  if (this.label) {
30
30
  this.label.addChangeObserver(this.onLabelChange);
31
- this.label.addOnDisposeObserver(() => this.dispose());
31
+ this.label.addOnDisposeObserver(this.dispose);
32
32
  this.onLabelChange();
33
33
  }
34
34
  else {
@@ -13,6 +13,7 @@ class OverlayColorPM extends AppObjectPM_1.AppObjectPM {
13
13
  };
14
14
  this.dispose = () => {
15
15
  var _a, _b;
16
+ super.dispose();
16
17
  (_a = this.overlayColor) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onColorChange);
17
18
  (_b = this.overlayColor) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
18
19
  };
@@ -23,7 +24,7 @@ class OverlayColorPM extends AppObjectPM_1.AppObjectPM {
23
24
  }
24
25
  else {
25
26
  this.overlayColor.addChangeObserver(this.onColorChange);
26
- this.overlayColor.addOnDisposeObserver(() => this.dispose());
27
+ this.overlayColor.addOnDisposeObserver(this.dispose);
27
28
  this.onColorChange();
28
29
  }
29
30
  }
@@ -16,6 +16,7 @@ class CanBeStuckPM extends AppObjectPM_1.AppObjectPM {
16
16
  };
17
17
  this.dispose = () => {
18
18
  var _a, _b;
19
+ super.dispose();
19
20
  (_a = this.transform) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onTransformChange);
20
21
  (_b = this.transform) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
21
22
  };
@@ -26,7 +27,7 @@ class CanBeStuckPM extends AppObjectPM_1.AppObjectPM {
26
27
  }
27
28
  else {
28
29
  this.transform.addChangeObserver(this.onTransformChange);
29
- this.transform.addOnDisposeObserver(() => this.dispose());
30
+ this.transform.addOnDisposeObserver(this.dispose);
30
31
  this.onTransformChange();
31
32
  }
32
33
  }
@@ -19,6 +19,7 @@ class Transform3DPM extends AppObjectPM_1.AppObjectPM {
19
19
  };
20
20
  this.dispose = () => {
21
21
  var _a, _b;
22
+ super.dispose();
22
23
  (_a = this.transform) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onTransformChange);
23
24
  (_b = this.transform) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
24
25
  };
@@ -29,7 +30,7 @@ class Transform3DPM extends AppObjectPM_1.AppObjectPM {
29
30
  }
30
31
  else {
31
32
  this.transform.addChangeObserver(this.onTransformChange);
32
- this.transform.addOnDisposeObserver(() => this.dispose());
33
+ this.transform.addOnDisposeObserver(this.dispose);
33
34
  this.onTransformChange();
34
35
  }
35
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/app",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Public package for the VIVED Learning App system",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",