@@ -1275,7 +1275,71 @@ <h2>The <dfn>InteractionOutput</dfn> interface</h2>
1275
1275
</ ol >
1276
1276
</ section >
1277
1277
</ section >
1278
- < section > < h3 > Using {{InteractionInput}} and {{InteractionOutput}}</ h3 >
1278
+
1279
+ < section data-dfn-for ="ActionInteractionOutput ">
1280
+ < h2 > The < dfn > ActionInteractionOutput</ dfn > interface</ h2 >
1281
+ < p >
1282
+ Belongs to the < a > WoT Consumer</ a > conformance class.
1283
+ An {{ActionInteractionOutput}} object is always created by the implementations
1284
+ and exposes the data returned from < a > WoT Interactions</ a > to application
1285
+ scripts.
1286
+ </ p >
1287
+ < p >
1288
+ This interface exposes an action status object. Its implementation
1289
+ will allow cancelling asynchronous actions and report the status of a long running action.
1290
+ </ p >
1291
+ < pre class ="idl ">
1292
+ enum ActionStatus {
1293
+ /* "pending", Profile has pending. Not sure what it would mean? */
1294
+ "running",
1295
+ "success", /* Profile uses completed? */
1296
+ "error" /* Profile uses failed? */
1297
+ };
1298
+
1299
+ [SecureContext, Exposed=(Window,Worker)]
1300
+ interface ActionInteractionOutput : InteractionOutput {
1301
+ readonly attribute object? error;
1302
+ Promise<ActionStatus> status();
1303
+ Promise<undefined> cancel();
1304
+ };
1305
+ </ pre >
1306
+ < p >
1307
+ The < dfn > error</ dfn > property represents a possible error, initially `null`.
1308
+ </ p >
1309
+ < p class ="ednote " title ="Should state be a function or an attribute only? ">
1310
+
1311
+ </ p >
1312
+ < p class ="ednote " title ="Additional action object functions needed? ">
1313
+ Should we allow pause/resume also? TD has no notion of it.
1314
+ </ p >
1315
+ < section > < h3 > The < dfn > status()</ dfn > function</ h3 >
1316
+ Reports the status of an < a > Action</ a > (one of < code > running</ code > , < code > success</ code > or < code > error</ code > ) or rejects on error. The method MUST run the following steps:
1317
+ < ol >
1318
+ < li >
1319
+ Return a {{Promise}} |promise:Promise| and execute the next steps
1320
+ [=in parallel=].
1321
+ </ li >
1322
+ < li >
1323
+ TODO
1324
+ </ li >
1325
+ </ ol >
1326
+ </ section >
1327
+ < section > < h3 > The < dfn > cancel()</ dfn > function</ h3 >
1328
+ Cancels a running WoT < a > Action</ a > or rejects on error. The method MUST run the following steps:
1329
+ < ol >
1330
+ < li >
1331
+ Return a {{Promise}} |promise:Promise| and execute the next steps
1332
+ [=in parallel=].
1333
+ </ li >
1334
+ < li >
1335
+ TODO
1336
+ </ li >
1337
+ </ ol >
1338
+ </ section >
1339
+
1340
+ </ section >
1341
+
1342
+ < section > < h3 > Using {{InteractionInput}}, {{InteractionOutput}} and {{ActionInteractionOutput}}</ h3 >
1279
1343
< p >
1280
1344
As illustrated in the next pictures, the {{InteractionOutput}} interface
1281
1345
is used every time implementations provide data to scripts, while
@@ -1323,7 +1387,7 @@ <h2>The <dfn>InteractionOutput</dfn> interface</h2>
1323
1387
< p >
1324
1388
When a {{ConsumedThing}} invokes an < a > Action</ a > , it provides the
1325
1389
parameters as {{InteractionInput}} and receives the output of the
1326
- < a > Action</ a > as an {{InteractionOutput }} object.
1390
+ < a > Action</ a > as an {{ActionInteractionOutput }} object.
1327
1391
</ p >
1328
1392
< p >
1329
1393
An {{ExposedThing}} < a href ="#the-actionhandler-callback ">
@@ -1386,7 +1450,7 @@ <h2>The <dfn>ConsumedThing</dfn> interface</h2>
1386
1450
/*Promise<undefined> writeAllProperties(
1387
1451
PropertyWriteMap valueMap,
1388
1452
optional InteractionOptions options = {});*/
1389
- Promise<InteractionOutput > invokeAction(DOMString actionName,
1453
+ Promise<ActionInteractionOutput > invokeAction(DOMString actionName,
1390
1454
optional InteractionInput params = {},
1391
1455
optional InteractionOptions options = {});
1392
1456
Promise<Subscription> observeProperty(DOMString name,
0 commit comments