@duet3d/objectmodel 3.4.0-b8 → 3.4.0-b9

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.
@@ -1,7 +1,9 @@
1
1
  import ModelObject, { IModelObject } from "../ModelObject";
2
+ export declare function isDriverId(value: any): value is DriverId;
2
3
  export declare class DriverId extends ModelObject {
3
4
  board: number;
4
5
  driver: number;
6
+ equals(value?: DriverId | null): boolean;
5
7
  update(jsonElement: any): IModelObject | null;
6
8
  toString(): string;
7
9
  }
@@ -1,14 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DriverId = void 0;
3
+ exports.DriverId = exports.isDriverId = void 0;
4
4
  const ModelObject_1 = require("../ModelObject");
5
+ function isDriverId(value) {
6
+ return (value instanceof Object) && (typeof value.board === "number") && (typeof value.driver === "number");
7
+ }
8
+ exports.isDriverId = isDriverId;
5
9
  class DriverId extends ModelObject_1.default {
6
10
  constructor() {
7
11
  super(...arguments);
8
12
  this.board = 0;
9
13
  this.driver = 0;
10
14
  }
15
+ equals(value) {
16
+ return isDriverId(value) && value.board === this.board && value.driver === this.driver;
17
+ }
11
18
  update(jsonElement) {
19
+ if (isDriverId(jsonElement)) {
20
+ this.board = jsonElement.board;
21
+ this.driver = jsonElement.driver;
22
+ }
12
23
  if (typeof jsonElement === "string") {
13
24
  const matches = /(\d+)\.(\d+)/.exec(jsonElement);
14
25
  if (matches !== null) {
@@ -22,7 +22,7 @@ class DeltaKinematics extends KinematicsBase_1.default {
22
22
  this.deltaRadius = 0;
23
23
  this.homedHeight = 0;
24
24
  this.printRadius = 0;
25
- this.towers = new ModelCollection_1.default(DeltaTower);
25
+ this.towers = (0, ModelCollection_1.initCollection)(DeltaTower, [{}, {}, {}]);
26
26
  this.xTilt = 0;
27
27
  this.yTilt = 0;
28
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duet3d/objectmodel",
3
- "version": "3.4.0-b8",
3
+ "version": "3.4.0-b9",
4
4
  "description": "TypeScript implementation of the Duet3D Object Model",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",