Skip to content

Use simple single and double quotes in code examples #525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2400,7 +2400,7 @@ <h2>ConsumedThing Examples</h2>
};

try {
// subscribe to property change for temperature
// subscribe to property change for "temperature"
await thing.observeProperty("temperature", async (data) => {
try {
console.log("Temperature changed to: " + await data.value());
Expand All @@ -2409,11 +2409,11 @@ <h2>ConsumedThing Examples</h2>
console.error(error);
}
});
// subscribe to the ready event defined in the TD
// subscribe to the "ready" event defined in the TD
await thing.subscribeEvent("ready", async (eventData) => {
try {
console.log("Ready; index: " + await eventData.value());
// run the startMeasurement action defined by TD
// run the "startMeasurement" action defined by TD
await thing.invokeAction("startMeasurement", { units: "Celsius" });
console.log("Measurement started.");
} catch (error) {
Expand All @@ -2432,7 +2432,7 @@ <h2>ConsumedThing Examples</h2>
console.log("Temperature: " + temperature);

await thing.unsubscribe("ready");
console.log("Unsubscribed from the ready event.");
console.log("Unsubscribed from the 'ready' event.");
} catch (error) {
console.log("Error in the cleanup function");
}
Expand All @@ -2457,7 +2457,7 @@ <h2>ConsumedThing Examples</h2>
let response;
let image;
try {
response = await thing.invokeAction(takePicture”));
response = await thing.invokeAction("takePicture");
image = await response.value() // throws NotReadableError --> schema not defined
} catch(ex) {
image = await response.arrayBuffer();
Expand Down Expand Up @@ -2519,7 +2519,7 @@ <h2>ConsumedThing Examples</h2>
parser.on('data', data => data.name === 'startObject' && ++objectCounter);
parser.on('end', () => console.log(`Found ${objectCounter} objects.`));

const response = await thing.readProperty(eventHistory)
const response = await thing.readProperty("eventHistory")
await response.data.pipeTo(parser);

// Found N objects
Expand Down Expand Up @@ -4237,7 +4237,7 @@ <h2>API design rationale</h2>
and the <code>open()</code> method are directly exposed on the object.
</p>
<pre class="example" title="Open a lock with a simple API">
let lock = await WoT.consume(https://td.my.com/lock-00123);
let lock = await WoT.consume('https://td.my.com/lock-00123');
console.log(lock.status);
lock.open('withThisKey');
</pre>
Expand All @@ -4262,8 +4262,8 @@ <h2>API design rationale</h2>
let res = await fetch(‘https://td.my.com/lock-00123’);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I did not change this line since it is already covered by #524.

let td = await res.json();
let lock = new ConsumedThing(td);
console.log(lock.readProperty(status));
lock.invokeAction(open, 'withThisKey');
console.log(lock.readProperty('status'));
lock.invokeAction('open', 'withThisKey');
</pre>
</section>
<p>
Expand Down