Skip to content

Commit 9a0e1f2

Browse files
committed
Fix #215: make the API entry point a namespace. Apply Web IDL namespace rules.
Signed-off-by: Zoltan Kis <[email protected]>
1 parent 028aeff commit 9a0e1f2

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

index.html

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -369,25 +369,21 @@ <h2>The <dfn>ThingDescription</dfn> type</h2>
369369
</section>
370370
</section>
371371

372-
<section data-dfn-for="WOT">
373-
<h2>The <dfn>WoT API object</dfn></h2>
372+
<section data-dfn-for="WebOfThings">
373+
<h2>The <dfn>WebOfThings</dfn> namespace</dfn></h2>
374374
<p>
375-
Defines the API entry point exposed as a singleton and contains the API methods.
375+
Defines the <dfn>WoT API object</dfn> as a singleton and contains the API
376+
methods, grouped by conformance classes.
376377
</p>
377-
<section> <h3>The <dfn>WOT</dfn> interface</h3>
378-
<pre class="idl">
379-
[SecureContext, Exposed=(Window,Worker)]
380-
interface WOT {
381-
// methods defined in UA conformance classes
382-
};
383-
</pre>
384-
<p class="note">
385-
Browser implementations should use a namespace object such as <code>navigator.wot</code>. Standalone runtimes may expose the API object through mechanisms like <a href="https://nodejs.org/api/modules.html">require()</a> or <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-imports">import</a>.
386-
</p>
387-
</section>
378+
<pre class="idl">
379+
[SecureContext, Exposed=(Window,Worker)]
380+
namespace WebOfThings {
381+
// methods defined in UA conformance classes
382+
};
383+
</pre>
388384
<section> <h3>The <dfn>consume()</dfn> method</h3>
389385
<pre class="idl">
390-
partial interface WOT {
386+
partial namespace WebOfThings {
391387
Promise&lt;ConsumedThing&gt; consume(ThingDescription td);
392388
};
393389
</pre>
@@ -423,7 +419,7 @@ <h2>The <dfn>WoT API object</dfn></h2>
423419

424420
<section> <h3>The <dfn>produce()</dfn> method</h3>
425421
<pre class="idl">
426-
partial interface WOT {
422+
partial namespace WebOfThings {
427423
Promise&lt;ExposedThing&gt; produce(ThingDescription td);
428424
};
429425
</pre>
@@ -448,7 +444,7 @@ <h2>The <dfn>WoT API object</dfn></h2>
448444

449445
<section> <h3>The <dfn>discover()</dfn> method</h3>
450446
<pre class="idl">
451-
partial interface WOT {
447+
partial namespace WebOfThings {
452448
ThingDiscovery discover(optional ThingFilter filter = null);
453449
};
454450
</pre>
@@ -2801,7 +2797,7 @@ <h2>ExposedThing Examples</h2>
28012797
onchange: temperatureValueDefinition
28022798
}
28032799
};
2804-
let thing1 = await WOT.produce(tdFragment);
2800+
let thing1 = await WebOfThings.produce(tdFragment);
28052801
// initialize Properties
28062802
await thing1.writeProperty("temperature", 0);
28072803
// add service handlers

0 commit comments

Comments
 (0)