Skip to content

Commit

Permalink
Merge pull request #1152 from danielpeintner/issue-1151
Browse files Browse the repository at this point in the history
refactor: revert back to *old* way of cloning
  • Loading branch information
relu91 authored Nov 6, 2023
2 parents 1441a01 + 2976374 commit 77d57d4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
"args": ["--client-only", "counter-client.js"],
"cwd": "${workspaceRoot}/examples/scripts/"
},
{
"type": "node",
"request": "launch",
"name": "Launch Counter",
"program": "${workspaceRoot}/packages/cli/dist/cli.js",
"args": ["counter.js"],
"cwd": "${workspaceRoot}/examples/scripts/"
},
{
"type": "node",
"request": "attach",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/cli-default-servient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default class DefaultServient extends Servient {
}

let coapServer: CoapServer | undefined;
if (this.config.servient.clientOnly == null) {
if (this.config.servient.clientOnly === false) {
if (this.config.http != null) {
const httpServer = new HttpServer(this.config.http);
this.addServer(httpServer);
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/exposed-thing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ export default class ExposedThing extends TD.Thing implements WoT.ExposedThing {
this.actions = {};
this.events = {};

const deepClonedModel = structuredClone(thingModel);
// Deep clone the Thing Model
// without functions or methods
const deepClonedModel = JSON.parse(JSON.stringify(thingModel));
Object.assign(this, deepClonedModel);

// unset "@type":"tm:ThingModel" ?
Expand Down

0 comments on commit 77d57d4

Please sign in to comment.