Skip to content

Commit

Permalink
Merge branch 'release/0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bcopy committed Oct 10, 2024
2 parents 7fc411c + bec6ebd commit be64bbb
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cmcrobotics/homie-lit",
"version": "0.6.5",
"version": "0.7.0",
"description": "A TypeScript library integrating Homie devices with DOM element attributes for visualization",
"repository": "github:cmcrobotics/homie-lit",
"main": "dist/homie-lit.js",
Expand Down
10 changes: 5 additions & 5 deletions src/HomieDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { HomieNode } from './HomieNode';
export class HomieDevice {
private nodes: Map<string, HomieNode> = new Map();

constructor(public name: string) {}
constructor(public id: string, public name: string = id, public type: string = '') { }

addNode(node: HomieNode) {
this.nodes.set(node.name, node);
this.nodes.set(node.id, node);
}

removeNode(node: HomieNode){
this.nodes.delete(node.name);
this.nodes.delete(node.id);
}

getNode(name: string): HomieNode | undefined {
return this.nodes.get(name);
getNode(id: string): HomieNode | undefined {
return this.nodes.get(id);
}

getAllNodes(): HomieNode[] {
Expand Down
8 changes: 4 additions & 4 deletions src/HomieNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { HomieProperty } from './HomieProperty';
export class HomieNode {
private properties: Map<string, HomieProperty> = new Map();

constructor(public name: string) {}
constructor(public id: string, public name: string = id, public type: string = '') { }

addProperty(property: HomieProperty) {
this.properties.set(property.name, property);
this.properties.set(property.id, property);
}

getProperty(name: string): HomieProperty | undefined {
return this.properties.get(name);
getProperty(id: string): HomieProperty | undefined {
return this.properties.get(id);
}

getAllProperties(): HomieProperty[] {
Expand Down
3 changes: 1 addition & 2 deletions src/HomieProperty.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export class HomieProperty {
constructor(public name: string, public value: any, public dataType: any) {}
constructor(public id: string, public name: string = id, public value: any, public dataType: any) {}

setValue(newValue: any) {
this.value = newValue;
// TODO: Implement update logic and event emission
}

getValue(): any {
Expand Down
4 changes: 2 additions & 2 deletions test/src/CoralBranch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { HomieProperty } from '../../src/HomieProperty';
export class CoralBranch extends HomieNode {
constructor(name: string) {
super(name);
this.addProperty(new HomieProperty('color', 'pink', 'string'));
this.addProperty(new HomieProperty('length', 10, 'integer'));
this.addProperty(new HomieProperty('color', 'Color', 'pink', 'string'));
this.addProperty(new HomieProperty('length', 'Length', 10, 'integer'));
}

// Add coral branch specific methods here
Expand Down
4 changes: 2 additions & 2 deletions test/src/PlayerAvatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { HomieProperty } from '../../src/HomieProperty';
export class PlayerAvatar extends HomieNode {
constructor(name: string) {
super(name);
this.addProperty(new HomieProperty('position', { x: 0, y: 0, z: 0 }, 'json'));
this.addProperty(new HomieProperty('rotation', { x: 0, y: 0, z: 0 }, 'json'));
this.addProperty(new HomieProperty('position', "Position", { x: 0, y: 0, z: 0 }, 'json'));
this.addProperty(new HomieProperty('rotation', "Rotation", { x: 0, y: 0, z: 0 }, 'json'));
}

// Add player avatar specific methods here
Expand Down

0 comments on commit be64bbb

Please sign in to comment.