Skip to content

Commit 77d57d4

Browse files
authored
Merge pull request #1152 from danielpeintner/issue-1151
refactor: revert back to *old* way of cloning
2 parents 1441a01 + 2976374 commit 77d57d4

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

.vscode/launch.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
"args": ["--client-only", "counter-client.js"],
1111
"cwd": "${workspaceRoot}/examples/scripts/"
1212
},
13+
{
14+
"type": "node",
15+
"request": "launch",
16+
"name": "Launch Counter",
17+
"program": "${workspaceRoot}/packages/cli/dist/cli.js",
18+
"args": ["counter.js"],
19+
"cwd": "${workspaceRoot}/examples/scripts/"
20+
},
1321
{
1422
"type": "node",
1523
"request": "attach",

packages/cli/src/cli-default-servient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default class DefaultServient extends Servient {
123123
}
124124

125125
let coapServer: CoapServer | undefined;
126-
if (this.config.servient.clientOnly == null) {
126+
if (this.config.servient.clientOnly === false) {
127127
if (this.config.http != null) {
128128
const httpServer = new HttpServer(this.config.http);
129129
this.addServer(httpServer);

packages/core/src/exposed-thing.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ export default class ExposedThing extends TD.Thing implements WoT.ExposedThing {
122122
this.actions = {};
123123
this.events = {};
124124

125-
const deepClonedModel = structuredClone(thingModel);
125+
// Deep clone the Thing Model
126+
// without functions or methods
127+
const deepClonedModel = JSON.parse(JSON.stringify(thingModel));
126128
Object.assign(this, deepClonedModel);
127129

128130
// unset "@type":"tm:ThingModel" ?

0 commit comments

Comments
 (0)