Skip to content

Commit dcde846

Browse files
refactor: update documentation about generating JS examples
update the JS output accordingly also
1 parent 4d083fc commit dcde846

File tree

13 files changed

+33
-32
lines changed

13 files changed

+33
-32
lines changed

examples/quickstart/presence-sensor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*
1414
* SPDX-License-Identifier: EPL-2.0 OR W3C-20150513
1515
********************************************************************************/
16+
Object.defineProperty(exports, "__esModule", { value: true });
1617
// This is an example Thing script which is a simple presence detector
1718
// It fires an event when it detects a person (mocked as every 5 second)
1819
const core_1 = require("@node-wot/core");

examples/quickstart/simple-coffee-machine.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*
1414
* SPDX-License-Identifier: EPL-2.0 OR W3C-20150513
1515
********************************************************************************/
16+
Object.defineProperty(exports, "__esModule", { value: true });
1617
// This is an example Thing script which is a simple coffee machine.
1718
// You can order coffee and see the status of the resources
1819
const core_1 = require("@node-wot/core");

examples/quickstart/smart-clock.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
*
1414
* SPDX-License-Identifier: EPL-2.0 OR W3C-20150513
1515
********************************************************************************/
16+
Object.defineProperty(exports, "__esModule", { value: true });
1617
// This is an example Thing which is a smart clock that runs 60 times faster than real time, where 1 hour happens in 1 minute.
1718
const core_1 = require("@node-wot/core");
1819
const binding_coap_1 = require("@node-wot/binding-coap");
1920
// create Servient add CoAP binding with port configuration
2021
const servient = new core_1.Servient();
21-
servient.addServer(new binding_coap_1.CoapServer(5686));
22+
servient.addServer(new binding_coap_1.CoapServer({ port: 5686 }));
2223
core_1.Helpers.setStaticAddress("plugfest.thingweb.io"); // comment this out if you are testing locally
2324
let minuteCounter = 0;
2425
let hourCounter = 0;

examples/scripts/countdown.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
"use strict";
12
/********************************************************************************
2-
* Copyright (c) 2022 Contributors to the Eclipse Foundation
3+
* Copyright (c) 2021 Contributors to the Eclipse Foundation
34
*
45
* See the NOTICE file(s) distributed with this work for additional
56
* information regarding copyright ownership.
@@ -12,7 +13,6 @@
1213
*
1314
* SPDX-License-Identifier: EPL-2.0 OR W3C-20150513
1415
********************************************************************************/
15-
1616
function uuidv4() {
1717
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
1818
const r = (Math.random() * 16) | 0;

examples/scripts/counter-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"use strict";
12
/********************************************************************************
23
* Copyright (c) 2020 Contributors to the Eclipse Foundation
34
*
@@ -12,7 +13,6 @@
1213
*
1314
* SPDX-License-Identifier: EPL-2.0 OR W3C-20150513
1415
********************************************************************************/
15-
1616
function getFormIndexForDecrementWithCoAP(thing) {
1717
const forms = thing.getThingDescription().actions?.decrement.forms;
1818
if (forms !== undefined) {

examples/scripts/counter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
"use strict";
12
/********************************************************************************
2-
* Copyright (c) 2022 Contributors to the Eclipse Foundation
3+
* Copyright (c) 2020 Contributors to the Eclipse Foundation
34
*
45
* See the NOTICE file(s) distributed with this work for additional
56
* information regarding copyright ownership.
@@ -12,7 +13,6 @@
1213
*
1314
* SPDX-License-Identifier: EPL-2.0 OR W3C-20150513
1415
********************************************************************************/
15-
1616
// This is an example Thing script.
1717
// It has a count property that can be incremented or decremented via actions and its changes are reported via events.
1818
// It also has two properties that return an image. The SVG property is also influenced by the increment and decrement actions.

examples/scripts/smart-coffee-machine-client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
"use strict";
12
/********************************************************************************
2-
* Copyright (c) 2022 Contributors to the Eclipse Foundation
3+
* Copyright (c) 2020 Contributors to the Eclipse Foundation
34
*
45
* See the NOTICE file(s) distributed with this work for additional
56
* information regarding copyright ownership.

examples/scripts/smart-coffee-machine.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
"use strict";
12
/********************************************************************************
2-
* Copyright (c) 2022 Contributors to the Eclipse Foundation
3+
* Copyright (c) 2020 Contributors to the Eclipse Foundation
34
*
45
* See the NOTICE file(s) distributed with this work for additional
56
* information regarding copyright ownership.

examples/security/oauth/consumer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
"use strict";
12
/********************************************************************************
2-
* Copyright (c) 2023 Contributors to the Eclipse Foundation
3+
* Copyright (c) 2018 Contributors to the Eclipse Foundation
34
*
45
* See the NOTICE file(s) distributed with this work for additional
56
* information regarding copyright ownership.

examples/security/oauth/exposer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
"use strict";
12
/********************************************************************************
2-
* Copyright (c) 2018 - 2020 Contributors to the Eclipse Foundation
3+
* Copyright (c) 2018 Contributors to the Eclipse Foundation
34
*
45
* See the NOTICE file(s) distributed with this work for additional
56
* information regarding copyright ownership.
@@ -12,6 +13,7 @@
1213
*
1314
* SPDX-License-Identifier: EPL-2.0 OR W3C-20150513
1415
********************************************************************************/
16+
Object.defineProperty(exports, "__esModule", { value: true });
1517
const td = {
1618
"@context": "https://www.w3.org/2019/wot/td/v1",
1719
title: "OAuth",

0 commit comments

Comments
 (0)