From 8ab29ca80e824b47f5256e0c43bdb85c4b235f36 Mon Sep 17 00:00:00 2001
From: danielpeintner
+ Belongs to the WoT Consumer conformance class.
+ An {{ActionInteractionOutput}} object is always created by the implementations
+ and exposes the data returned from WoT Interactions to application
+ scripts.
+
+ This interface exposes an action status object. Its implementation
+ will allow cancelling asynchronous actions and report the status of a long running action.
+
+ The error property represents a possible error, initially `null`.
+
+
+
+ Should we allow pause/resume also? TD has no notion of it.
+
As illustrated in the next pictures, the {{InteractionOutput}} interface
is used every time implementations provide data to scripts, while
@@ -1323,7 +1387,7 @@
When a {{ConsumedThing}} invokes an Action, it provides the
parameters as {{InteractionInput}} and receives the output of the
- Action as an {{InteractionOutput}} object.
+ Action as an {{ActionInteractionOutput}} object.
An {{ExposedThing}}
@@ -1386,7 +1450,7 @@
Belongs to the WoT Consumer conformance class.
An {{ActionInteractionOutput}} object is always created by the implementations
- and exposes the data returned from WoT Interactions to application
- scripts.
+ and exposes functionality to interact with long running (asynchronous) actions.
This interface exposes an action status object. Its implementation
@@ -1332,7 +1332,7 @@ The InteractionOutput interface
- Using {{InteractionInput}} and {{InteractionOutput}}
+
+ The ActionInteractionOutput interface
+
+ enum ActionStatus {
+ /* "pending", Profile has pending. Not sure what it would mean? */
+ "running",
+ "success", /* Profile uses completed? */
+ "error" /* Profile uses failed? */
+ };
+
+ [SecureContext, Exposed=(Window,Worker)]
+ interface ActionInteractionOutput : InteractionOutput {
+ readonly attribute object? error;
+ Promise<ActionStatus> status();
+ Promise<undefined> cancel();
+ };
+
+ The status() function
+ Reports the status of an Action (one of running
, success
or error
) or rejects on error. The method MUST run the following steps:
+
+
+ The cancel() function
+ Cancels a running WoT Action or rejects on error. The method MUST run the following steps:
+
+
+ Using {{InteractionInput}}, {{InteractionOutput}} and {{ActionInteractionOutput}}
The InteractionOutput interface
The ConsumedThing interface
/*Promise<undefined> writeAllProperties(
PropertyWriteMap valueMap,
optional InteractionOptions options = {});*/
- Promise<InteractionOutput> invokeAction(DOMString actionName,
+ Promise<ActionInteractionOutput> invokeAction(DOMString actionName,
optional InteractionInput params = {},
optional InteractionOptions options = {});
Promise<Subscription> observeProperty(DOMString name,
diff --git a/typescript/scripting-api/index.d.ts b/typescript/scripting-api/index.d.ts
index 06a3fad..8d0e9d6 100644
--- a/typescript/scripting-api/index.d.ts
+++ b/typescript/scripting-api/index.d.ts
@@ -88,6 +88,14 @@ declare namespace WoT {
value(): PromiseThe ActionInteractionOutput interface
+ Note: a synchronous action MAY not offer any The ActionInteractionOutput interface
[=in parallel=].
The ActionInteractionOutput interface
enum ActionStatus { - /* "pending", Profile has pending. Not sure what it would mean? */ "running", - "success", /* Profile uses completed? */ - "error" /* Profile uses failed? */ + "success", + "error" }; [SecureContext, Exposed=(Window,Worker)] From 54a2f5075d83a0860b7314d27fb998a68eff0537 Mon Sep 17 00:00:00 2001 From: danielpeintnerDate: Tue, 15 Oct 2024 09:52:25 +0200 Subject: [PATCH 4/4] Update index.html Co-authored-by: Jan Romann --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 0ad4238..d8fe179 100644 --- a/index.html +++ b/index.html @@ -1280,7 +1280,7 @@ The InteractionOutput interface
The ActionInteractionOutput interface
Belongs to the WoT Consumer conformance class. - An {{ActionInteractionOutput}} object is always created by the implementations + An {{ActionInteractionOutput}} object is always created by a consumer implementation and exposes functionality to interact with long running (asynchronous) actions.
Note: a synchronous action MAY not offer anyadditional sensible interaction beyond the ones from {{InteractionOutput}}.