diff --git a/index.html b/index.html
index 51062985..086f8127 100644
--- a/index.html
+++ b/index.html
@@ -1017,15 +1017,13 @@
The ConsumedThing interface
Promise<InteractionOutput> invokeAction(DOMString actionName,
optional InteractionInput params = null,
optional InteractionOptions options = null);
- Promise<undefined> observeProperty(DOMString name,
- WotListener listener,
+ Promise<Subscription> observeProperty(DOMString name,
+ InteractionListener listener,
+ optional ErrorListener onerror,
optional InteractionOptions options = null);
- Promise<undefined> unobserveProperty(DOMString name,
- optional InteractionOptions options = null);
- Promise<undefined> subscribeEvent(DOMString name,
- WotListener listener,
- optional InteractionOptions options = null);
- Promise<undefined> unsubscribeEvent(DOMString name,
+ Promise<Subscription> subscribeEvent(DOMString name,
+ InteractionListener listener,
+ optional ErrorListener onerror,
optional InteractionOptions options = null);
ThingDescription getThingDescription();
};
@@ -1036,14 +1034,43 @@ The ConsumedThing interface
any data;
};
+ [SecureContext, Exposed=(Window,Worker)]
+ interface Subscription {
+ readonly attribute boolean active;
+ Promise<undefined> stop(optional InteractionOptions options = null);
+ };
+
typedef object PropertyMap;
- callback WotListener = undefined(InteractionOutput data);
+ callback InteractionListener = undefined(InteractionOutput data);
+ callback ErrorListener = undefined(Error error);
The writeAllProperties()
method is still under discussion.
- eanwhile, use the writeMultipleProperties()
method instead.
+ Meanwhile, use the writeMultipleProperties()
method instead.
+
+ Internal slots for ConsumedThing
+
+ A {{ConsumedThing}} object has the following internal slots:
+
+
+
+
+ Internal Slot |
+ Initial value |
+ Description (non-normative) |
+
+
+
+
+ [[\td]] |
+ `null` |
+ The Thing Description of the {{ConsumedThing}}. |
+
+
+
+
Constructing ConsumedThing
@@ -1067,7 +1094,7 @@ Constructing ConsumedThing
Let |thing:ConsumedThing| be a new {{ConsumedThing}} object.
- Let ||td|| be an internal slot of |thing| and let |td| be its value.
+ Set the internal slot [[\td]] of |thing| to |td|.
Return |thing|.
@@ -1079,55 +1106,10 @@ Constructing ConsumedThing
The getThingDescription() method
- Returns the internal slot ||td|| of the {{ConsumedThing}} object that represents the Thing Description of the {{ConsumedThing}}.
- Applications may consult the Thing metadata stored in ||td|| in order to introspect its capabilities before interacting with it.
-
-
-
-
-
- The InteractionOptions dictionary
-
-
- Holds the interaction options that need to be exposed for application scripts according to the Thing Description.
-
-
- The formIndex property, if defined, represents an application
- hint for which Form
definition, identified by this index,
- of the TD to use for the given WoT interaction.
- Implementations SHOULD use the Form
with this index for
- making the interaction, but MAY override this value if the index is not
- found or not valid.
- If not defined, implementations SHOULD attempt to use the
- Form
definitions in order of appearance as listed in the
- TD for the given Wot Interaction.
-
-
- The uriVariables property if defined, represents the URI
- template variables to be used with the WoT Interaction that are represented
- as
- parsed JSON objects defined in [[!WOT-TD]].
-
-
- The support for URI variables comes from the need, exposed by the [[[WOT-TD]]] specification, to be able to describe
- existing REST-ful endpoints that use them. However, it should be possible to write a Thing Description that would use
- Actions for representing this kind of interactions and model the URI variables as action parameters. In that case,
- implementations can serialize the parameters as URI variables, and therefore, the |options| parameter could be
- dismissed.
-
-
- The data property if defined, represents additional opaque
- data that needs to be passed to the interaction.
-
-
-
-
- The PropertyMap type
-
- Represents a map of Property names as strings to a value that the Property can take. It is used as a property bag for interactions that involve multiple Properties at once.
-
-
- It could be defined in Web IDL (as well as {{ThingDescription}}) as a maplike interface from string to any.
+ Returns the internal slot [[\td]] of the {{ConsumedThing}} object
+ that represents the Thing Description of the {{ConsumedThing}}.
+ Applications may consult the Thing metadata stored in [[\td]] in
+ order to introspect its capabilities before interacting with it.
@@ -1150,7 +1132,7 @@ The readProperty() method
{{SecurityError}} and abort these steps.
- Let |interaction| be the value of ||td||'s |properties|'s
+ Let |interaction| be the value of [[\td]]'s |properties|'s
|propertyName|.
@@ -1205,7 +1187,7 @@ The readMultipleProperties() method
If |option|'s |formIndex| is defined, let |form| be the
- Form associated with |formIndex| in ||td||'s |forms| array, otherwise let |form| be the first Form in ||td||'s |forms| array whose |op| is `readmultipleproperties`.
+ Form associated with |formIndex| in [[\td]]'s |forms| array, otherwise let |form| be the first Form in [[\td]]'s |forms| array whose |op| is `readmultipleproperties`.
If |form| is failure, reject |promise| with a {{SyntaxError}} and abort these steps.
@@ -1227,7 +1209,7 @@ The readMultipleProperties() method
Let |value| be the value of |result|'s |key|.
- Let |schema| be the value of ||td||'s |properties|'s |key|.
+ Let |schema| be the value of [[\td]]'s |properties|'s |key|.
Let |property| be the result of running
@@ -1263,7 +1245,7 @@ The readAllProperties() method
If |option|'s |formIndex| is defined, let |form| be the
- Form associated with |formIndex| in ||td||'s |forms| array, otherwise let |form| be the first Form in ||td||'s |forms| array whose |op| is `readallproperties`.
+ Form associated with |formIndex| in [[\td]]'s |forms| array, otherwise let |form| be the first Form in [[\td]]'s |forms| array whose |op| is `readallproperties`.
If |form| is failure, reject |promise| with a {{SyntaxError}} and abort these steps.
@@ -1288,7 +1270,7 @@ The readAllProperties() method
Let |value| be the value of |result|'s |key|.
- Let |schema| be the value of ||td||'s |properties|'s |key|.
+ Let |schema| be the value of [[\td]]'s |properties|'s |key|.
Let |property| be the result of running
@@ -1319,7 +1301,7 @@ The writeProperty() method
If invoking this method is not allowed for the current scripting context for security reasons, reject |promise| with a {{SecurityError}} and abort these steps.
- Let |interaction| be the value of ||td||'s |properties|'s
+ Let |interaction| be the value of [[\td]]'s |properties|'s
|propertyName|.
@@ -1379,8 +1361,8 @@ The writeMultipleProperties() method
If |option|'s |formIndex| is defined, let |form| be the
- Form associated with |formIndex| in ||td||'s |forms| array,
- otherwise let |form| be the first Form in ||td||'s |forms|
+ Form associated with |formIndex| in [[\td]]'s |forms| array,
+ otherwise let |form| be the first Form in [[\td]]'s |forms|
array whose |op| is `writemultipleproperties`.
@@ -1391,7 +1373,7 @@ The writeMultipleProperties() method
Let |propertyNames| be an array of |string| with as elements the keys of the |properties| object.
- For each |name:string| in |propertyNames|, let |property| be the value of ||td||'s |properties|'s |name|.
+ For each |name:string| in |propertyNames|, let |property| be the value of [[\td]]'s |properties|'s |name|.
If |property| is `null` or `undefined` or is not `writeable` reject |promise| with {{NotSupportedError}}
and abort these steps.
@@ -1402,7 +1384,7 @@ The writeMultipleProperties() method
Let |schemas:object| be an object and for each string |name:string|
in |propertyNames| add a property with key |name| and let its value
- be the value of ||td||'s |properties|'s |name|.
+ be the value of [[\td]]'s |properties|'s |name|.
For each key |key:string| in |properties|, take its value as |value|
@@ -1432,23 +1414,13 @@ The writeMultipleProperties() method
-
- The WotListener callback
-
- User provided callback that is given an argument of type
- {{InteractionOutput}} and is used for observing Property changes
- and handling Event notifications.
- Since subscribing to Events are WoT interactions and might take
- options or even data, they are not modelled with software events.
-
-
The observeProperty() method
Makes a request for
Property value change notifications.
- Takes as arguments |propertyName:string|, |listener:WotListener| and
- optionally |options:InteractionOptions|.
+ Takes as arguments |propertyName:string|, |listener:InteractionListener| and
+ optionally |onerror:ErrorListener| and |options:InteractionOptions|.
It returns a {{Promise}} that resolves on success and rejects on failure.
The method MUST run the following steps:
@@ -1463,82 +1435,79 @@ The observeProperty() method
with a {{TypeError}} and abort these steps.
-
- Let |interaction| be the value of ||td||'s |properties|'s
- |propertyName|.
-
- -
- If |option|'s |formIndex| is defined, let |form| be the
- Form associated with |formIndex| in |interaction|'s |forms|
- array, otherwise let |form| be the first Form in
- |interaction|'s |forms| array whose |op| is `observeproperty`.
+ If |onerror| is not `null` and is not a {{Function}}, reject |promise|
+ with a {{TypeError}} and abort these steps.
-
- If |form| is failure, reject |promise| with a {{SyntaxError}} and abort these steps.
+ Let |subscription| be a new {{Subscription}} object with its internal slots
+ set as follows:
+
+ -
+ Let |subscription|'s [[\type]] be `"property"`.
+
+ -
+ Let |subscription|'s [[\name]] be the value of |propertyName|.
+
+ -
+ Let |subscription|'s [[\interaction]] be the value of [[\td]]'s
+ |properties|'s |propertyName|.
+
+ -
+ Let |subscription|'s [[\form]] be the Form associated with
+ |formIndex| in [[\interaction]]'s |forms| array if |option|'s
+ |formIndex| is defined, otherwise let [[\form]] be the first
+ Form in [[\interaction]]'s |forms| array whose |op| is
+ `"observeproperty"`.
+
+ -
+ If |subscription|'s [[\form]] is failure, reject |promise| with a
+ {{SyntaxError}} and abort these steps.
+
+
-
- Make a request to the underlying platform (via the Protocol Bindings) to observe Property identified by |propertyName| with |form| and optional URI templates given in |options|' |uriVariables|.
+ Make a request to the underlying platform to observe the
+ Property identified by |propertyName| with |form| and
+ optional URI templates given in |options|' |uriVariables|.
-
- If the request fails, reject |promise| with the error received from the Protocol Bindings and abort these steps.
+ If the request fails, reject |promise| with the error received from
+ the Protocol Bindings and abort these steps.
-
Otherwise resolve |promise|.
-
- Whenever the underlying platform receives a notification for this subscription with new Property value |value|, run the following sub-steps:
+ Whenever the underlying platform detects a notification for this
+ subscription with a new Property value |value|,
+ run the following sub-steps:
-
Let |reply| be the result of running parse interaction response
- with |value|, |form| and |interaction|. If that throws, reject |promise| with that exception and abort these steps.
+ with |value|, [[\form]] and [[\interaction]].
+ If that throws, reject |promise| with that exception and abort these steps.
-
Invoke |listener| with |reply|.
-
-
-
-
-
- The unobserveProperty() method
-
- Makes a request for unsubscribing from
Property value change notifications.
- Takes as arguments |propertyName:string| and optionally |options:InteractionOptions|.
- It returns a {{Promise}} that resolves on success and rejects on failure.
- The method MUST run the following steps:
-
- -
- Return a {{Promise}} |promise:Promise| and execute the next steps in parallel.
-
- -
- If invoking this method is not allowed for the current scripting context for security reasons, reject |promise| with a {{SecurityError}} and abort these steps.
-
- -
- Let |interaction| be the value of ||td||'s |properties|'s
- |propertyName|.
-
- -
- If |option|'s |formIndex| is defined, let |form| be the
- Form associated with |formIndex| in |interaction|'s |forms|
- array, otherwise let |form| be the first Form in
- |interaction|'s |forms| array whose |op| is `unobserveproperty`.
-
-
- If |form| is failure, reject |promise| with a {{SyntaxError}} and abort these steps.
-
- -
- Make a request to the underlying platform (via the Protocol Bindings) to stop observing the Property identified by |propertyName|, with |form| and optional URI templates given in |options|' |uriVariables|.
-
- -
- If the request fails, reject |promise| with the error received from the Protocol Bindings and abort these steps.
-
- -
- Otherwise resolve |promise|.
-
- -
- If the underlying platform receives further notifications for this subscription with new Property value, implementations SHOULD
- silently suppress them.
+ Whenever the underlying platform detects an error for
+ this subscription, run the following sub-steps:
+
+ -
+ If the error is irrecoverable and stops the subscription, set
+ |subscription|'s |active| to `false` and suppress further notifications.
+
+ -
+ Let |error| be a new {{NetworkError}} and set its |message|
+ to reflect the underlying error condition.
+
+ -
+ If |onerror| is a {{Function}}, invoke it with |error|.
+
+
@@ -1561,7 +1530,7 @@ The invokeAction() method
If invoking this method is not allowed for the current scripting context for security reasons, reject |promise| with a {{SecurityError}} and abort these steps.
- Let |interaction| be the value of ||td||'s |actions|'s
+ Let |interaction| be the value of [[\td]]'s |actions|'s
|actionName|.
@@ -1601,7 +1570,7 @@ The subscribeEvent() method
Makes a request for subscribing to
Event notifications.
Takes as arguments |eventName:string|, |listener:WoTListener| and
- optionally |options:InteractionOptions|.
+ optionally |onerror:ErrorListener| and |options:InteractionOptions|.
It returns a {{Promise}} to signal success or failure.
The method MUST run the following steps:
@@ -1616,77 +1585,308 @@ The subscribeEvent() method
with a {{TypeError}} and abort these steps.
-
- Let |interaction| be the value of ||td||'s |events|'s |eventName|.
-
- -
- If |option|'s |formIndex| is defined, let |form| be the
- Form associated with |formIndex| in |interaction|'s |forms|
- array, otherwise let |form| be the first Form in
- |interaction|'s |forms| array whose |op| is `subscribeevent`.
+ If |onerror| is not `null` and is not a {{Function}}, reject |promise|
+ with a {{TypeError}} and abort these steps.
-
- If |form| is failure, reject |promise| with a {{SyntaxError}} and abort these steps.
+ Let |subscription| be a new {{Subscription}} object with its internal slots
+ set as follows:
+
+ -
+ Let |subscription|'s [[\type]] be `"event"`.
+
+ -
+ Let |subscription|'s [[\name]] be the value of |eventName|.
+
+ -
+ Let |subscription|'s [[\interaction]] be the value of [[\td]]'s
+ |events|'s |eventName|.
+
+ -
+ Let |subscription|'s [[\form]] be the Form associated with
+ |formIndex| in [[\interaction]]'s |forms| array if |option|'s
+ |formIndex| is defined, otherwise let [[\form]] be the first
+ Form in [[\interaction]]'s |forms| array whose |op| is
+ `"subscribeevent"`.
+
+ -
+ If |subscription|'s [[\form]] is failure, reject |promise| with a
+ {{SyntaxError}} and abort these steps.
+
+
-
- Make a request to the underlying platform (via the Protocol Bindings) to subscribe to an Event identified by |eventName:string| with |form| and optional URI templates given in |options|' |uriVariables|
+ Make a request to the underlying platform via the Protocol Bindings
+ to subscribe to an Event identified by |eventName:string| with
+ [[\form]], optional URI templates given in |options|' |uriVariables|
and optional subscription data given in |options|'s |data|.
-
- If the request fails, reject |promise| with the error received from the Protocol Bindings and abort these steps.
+ If the request fails, reject |promise| with the error received from
+ the Protocol Bindings and abort these steps.
-
Otherwise resolve |promise|.
-
- Whenever the underlying platform receives a notification for this Event subscription, implementations SHOULD invoke
- |listener| with the result of running parse interaction response on the data provided with the Event, |form| and |interaction|.
+ Whenever the underlying platform detects a notification for this
+ Event subscription, run the following sub-steps:
+
+ -
+ Invoke |listener| with the result of running
+ parse interaction response on the data provided with the
+ Event, [[\form]] and [[\interaction]].
+
+
+
+ -
+ Whenever the underlying platform detects an error for
+ this subscription, run the following sub-steps:
+
+ -
+ If the error is irrecoverable and stops the subscription, set
+ |subscription|'s |active| to `false` and suppress further notifications.
+
+ -
+ Let |error| be a new {{NetworkError}} and set its |message|
+ to reflect the underlying error condition.
+
+ -
+ If |onerror| is a {{Function}}, invoke it with |error|.
+
+
+
+
+ The InteractionOptions dictionary
+
+
+ Holds the interaction options that need to be exposed for application scripts according to the Thing Description.
+
+
+ The formIndex property, if defined, represents an application
+ hint for which Form
definition, identified by this index,
+ of the TD to use for the given WoT interaction.
+ Implementations SHOULD use the Form
with this index for
+ making the interaction, but MAY override this value if the index is not
+ found or not valid.
+ If not defined, implementations SHOULD attempt to use the
+ Form
definitions in order of appearance as listed in the
+ TD for the given Wot Interaction.
+
+
+ The uriVariables property if defined, represents the URI
+ template variables to be used with the WoT Interaction that are represented
+ as
+ parsed JSON objects defined in [[!WOT-TD]].
+
+
+ The support for URI variables comes from the need, exposed by the [[[WOT-TD]]] specification, to be able to describe
+ existing REST-ful endpoints that use them. However, it should be possible to write a Thing Description that would use
+ Actions for representing this kind of interactions and model the URI variables as action parameters. In that case,
+ implementations can serialize the parameters as URI variables, and therefore, the |options| parameter could be
+ dismissed.
+
+
+ The data property if defined, represents additional opaque
+ data that needs to be passed to the interaction.
+
+
+
- The unsubscribeEvent() method
-
- Makes a request for unsubscribing from
Event notifications.
- Takes as arguments |eventName:string| and optionally
- |options:InteractionOptions|.
- It returns a {{Promise}} to signal success or failure.
- The method MUST run the following steps:
+
The PropertyMap type
+
+ Represents a map of Property names as strings to a value that the Property can take. It is used as a property bag for interactions that involve multiple Properties at once.
+
+
+ It could be defined in Web IDL (as well as {{ThingDescription}}) as a maplike interface from string to any.
+
+
+
+
+
+ The InteractionListener callback
+
+ User provided callback that is given an argument of type
+ {{InteractionOutput}} and is used for observing Property changes
+ and handling Event notifications.
+ Since subscribing to Events are WoT interactions and might take
+ options or even data, they are not modelled with software events.
+
+
+
+
+ The ErrorListener callback
+
+ User provided callback that is given an argument of type
+ {{Error}} and is used for conveying critical and non-critical errors
+ from the Protocol Bindings to applications.
+
+
+
+
+ The Subscription interface
+
+ Represents a subscription to Property change and Event
+ interactions.
+
+
+ The active boolean property denotes if the subscription is
+ active, i.e. it is not stopped because of an error or because of invocation
+ of the stop()
method.
+
+ Internal slots for {{Subscription}}
+ A {{Subscription}} object has the following internal slots:
+
+
+
+ Internal Slot |
+ Initial value |
+ Description (non-normative) |
+
+
+
+
+ [[\type]] |
+ `null` |
+
+ Indicates what WoT Interaction the {{Subscription}} refers to.
+ The value can be either `"property"` or `"event"` or `null`.
+ |
+
+
+ [[\name]] |
+ `null` |
+ The Property or Event name. |
+
+
+ [[\interaction]] |
+ `null` |
+
+ The Thing Description fragment that describes the
+ WoT interaction.
+ |
+
+
+ [[\form]] |
+ `null` |
+ The Form associated with the subscription. |
+
+
+
+
+
+ The stop() method
+
+ Stops delivering notifications for the subscription. It takes an
+ optional parameter |options:InteractionOptions| and returns a {{Promise}}.
+ When invoked, the method MUST execute the following steps:
+
+ -
+ Return a {{Promise}} |promise:Promise| and execute the next steps
+ in parallel.
+
+ -
+ If invoking this method is not allowed for the current scripting
+ context for security reasons, reject |promise| with a
+ {{SecurityError}} and abort these steps.
+
+ -
+ If |options|' |formIndex| is defined, let |unsubscribeForm| be the
+ Form associated with |formIndex| in [[\interaction]]'s
+ |forms| array.
+
+ -
+ Otherwise let |unsubscribeForm| be the result of running the
+ find a matching unsubscribe form algorithm given [[\form]].
+
+ -
+ If |unsubscribeForm| is failure, reject |promise| with a {{SyntaxError}} and
+ abort these steps.
+
+ -
+ If [[\type]] is `"property"`, make a request to the underlying
+ platform via the Protocol Bindings to stop observing the
+ Property identified by [[\name]] with |unsubscribeForm| and optional
+ URI templates given in |options|' |uriVariables|.
+
+ -
+ Otherwise, if [[\type]] is `"event"`, make a request to the underlying
+ platform via the Protocol Bindings to unsubscribe from the
+ Event identified by [[\name]] with |unsubscribeForm|, with optional URI
+ templates given in |options|' |uriVariables| and optional
+ unsubscribe data given in |options|'s |data|.
+
+ -
+ If the request fails, reject |promise| with the error received from
+ the Protocol Bindings and abort these steps.
+
+ -
+ Otherwise set active to
+ `false` and resolve |promise|.
+
+ -
+ If the underlying platform receives further notifications for this
+ subscription, implementations SHOULD silently suppress them.
+
+
+
+
+ Finding an unsubscribe Form
+ To find a matching unsubscribe form given |subscribeForm|
+ in the context of a {{Subscription}} object, run the following steps:
+
+ This algorithm is under development and is non-normative.
+ Implementations MAY choose another algorithm to find a matching
+ `unsubscribe` Form to a given `subscribe` Form.
+
-
- Return a {{Promise}} |promise:Promise| and execute the next steps in parallel.
-
- -
- If invoking this method is not allowed for the current scripting context for security reasons, reject |promise| with a {{SecurityError}} and abort these steps.
-
- -
- Let |interaction| be the value of ||td||'s |events|'s |eventName|.
-
- -
- If |option|'s |formIndex| is defined, let |form| be the
- Form associated with |formIndex| in |interaction|'s |forms|
- array, otherwise let |form| be the first Form in
- |interaction|'s |forms| array whose |op| is `unsubscribeevent`.
-
- -
- If |form| is failure, reject |promise| with a {{SyntaxError}} and abort these steps.
-
- -
- Make a request to the underlying platform (via the Protocol Bindings) to unsubscribe from the Event identified by |eventName| with |form| and optional URI templates given in |options|' |uriVariables|
- and optional unsubscribe data given in |options|'s |data|.
+ Let |results| be an empty array.
-
- If the request fails, reject |promise| with the error received from the Protocol Bindings and abort these steps.
+ For each |form| in [[\interaction]]'s |forms| array,
+
+ -
+ Add an internal slot [[\matchLevel]] on |form| and set
+ its value to `0`.
+
+ -
+ If |form|'s |op| is `"unobserveproperty"` if [[\type]] is
+ `"property"` or if |form|'s |op| is `"unsubscribeevent"`
+ if [[\type]] is`"event"`,
+
+ -
+ Set the internal slot [[\matchLevel]] on |form| to 1
+ and add |form| to |results|.
+
+ -
+ If |form|'s |href| and [[\subscribeForm]]'s |href| are
+
+ same origin-domain, increment |form|'s [[\matchLevel]].
+
+ -
+ If |form|'s |contentType| is equal to [[\subscribeForm]]'s
+ |contentType| and |form|'s [[\matchLevel]] is greater than 2,
+ increment |form|'s [[\matchLevel]].
+
+
+
+
-
- Resolve |promise|.
+ If |results| is empty, return `null` and terminate these steps.
-
- If the underlying platform receives further notifications for this Event subscription, implementations SHOULD silently suppress them.
+ Return the first |form| in |results| that has the highest
+ [[\matchLevel]] value.
-
+
@@ -1907,7 +2107,7 @@ Constructing {{ExposedThing}}
Let |thing:ExposedThing| be a new {{ExposedThing}} object.
- Let ||td|| be an internal slot of |thing| and let |td| be its value.
+ Set the internal slot [[\td]] of |thing| to |td|.
Return |thing|.
@@ -1964,7 +2164,7 @@ The PropertyReadHandler callback
The |handler| callback function should implement reading a Property and SHOULD be called by implementations when a request for reading a Property is received from the underlying platform.
- There MUST be at most one handler for any given Property, so newly added handlers MUST replace the previous handlers. If no handler is initialized for any given Property, implementations SHOULD implement a default property read handler based on the Thing Description provided in the ||td|| internal slot.
+ There MUST be at most one handler for any given Property, so newly added handlers MUST replace the previous handlers. If no handler is initialized for any given Property, implementations SHOULD implement a default property read handler based on the Thing Description provided in the [[\td]] internal slot.
When the method is invoked given |name:string| and
@@ -1975,7 +2175,7 @@
The PropertyReadHandler callback
If invoking this method is not allowed for the current scripting context for security reasons, [= exception/throw =] a {{SecurityError}} and abort these steps.
- Let |interaction| be the value of ||td||'s |properties|'s
+ Let |interaction| be the value of [[\td]]'s |properties|'s
|name|.
@@ -1983,8 +2183,8 @@ The PropertyReadHandler callback
[= exception/throw =] {{NotFoundError}} and abort these steps.
- Set the internal slot ||readHandler|| on |interaction| to
- |handler|.
+ Add the internal slot [[\readHandler]] to |interaction| and
+ set it to |handler|.
@@ -2009,7 +2209,7 @@ The PropertyReadHandler callback
steps with |name:string| and |options:InteractionOptions|:
-
- Let |interaction| be the value of ||td||'s |properties|'s
+ Let |interaction| be the value of [[\td]]'s |properties|'s
|name|.
-
@@ -2019,7 +2219,7 @@
The PropertyReadHandler callback
Let |handler:function| be `null`.
-
- If there is a user provided internal slot ||readHandler||
+ If there is a user provided internal slot [[\readHandler]]
on |interaction|, let |handler| be that.
-
@@ -2140,7 +2340,7 @@
The PropertyReadHandler callback
If invoking this method is not allowed for the current scripting context for security reasons, [= exception/throw =] a {{SecurityError}} and abort these steps.
-
- Let |interaction| be the value of ||td||'s |properties|'s
+ Let |interaction| be the value of [[\td]]'s |properties|'s
|name|.
-
@@ -2148,7 +2348,7 @@
The PropertyReadHandler callback
[= exception/throw =] {{NotFoundError}} and abort these steps.
-
- Set the internal slot ||observeHandler|| on |interaction|
+ Set the internal slot [[\observeHandler]] on |interaction|
to |handler|.
@@ -2170,7 +2370,7 @@ The PropertyReadHandler callback
according to the Protocol Bindings and abort these steps.
- Let |property| be the value of ||td||'s |properties|'s |name|.
+ Let |property| be the value of [[\td]]'s |properties|'s |name|.
If it does not exist, send back a {{NotFoundError}} in the
reply and abort these steps.
@@ -2186,11 +2386,11 @@ The PropertyReadHandler callback
Let |handler:function| be `null.`
- If there is an ||observeHandler|| internal slot associated
+ If there is an [[\observeHandler]] internal slot associated
with |name| on |property|, let |handler| be that.
- Otherwise, if there is a ||readHandler|| internal slot
+ Otherwise, if there is a [[\readHandler]] internal slot
associated with |name| on |property|, let |handler| be that.
@@ -2203,7 +2403,8 @@ The PropertyReadHandler callback
If |promise| rejects, abort these steps.
- If |promise| resolves with |data|, then for each |observer| in |property|'s internal observer list, run the following
+ If |promise| resolves with |data|, then for each |observer| in
+ |property|'s internal observer list, run the following
sub-steps:
-
@@ -2249,7 +2450,7 @@
The PropertyReadHandler callback
{{SecurityError}} and abort these steps.
-
- Let |interaction| be the value of ||td||'s |properties|'s
+ Let |interaction| be the value of [[\td]]'s |properties|'s
|name|.
-
@@ -2257,7 +2458,7 @@
The PropertyReadHandler callback
[= exception/throw =] {{NotFoundError}} and abort these steps.
-
- Set the internal slot ||unobserveHandler|| on |interaction|
+ Set the internal slot [[\unobserveHandler]] on |interaction|
to |handler|.
@@ -2279,14 +2480,14 @@ The PropertyReadHandler callback
according to the Protocol Bindings and abort these steps.
- Let |property| be the value of ||td||'s |properties|'s |name|.
+ Let |property| be the value of [[\td]]'s |properties|'s |name|.
If it does not exist, send back a {{NotFoundError}} in the
reply and abort these steps.
- If there is an ||unobserveHandler|| defined for |name| on |property|,
- invoke that with |options|, send back a reply following the
- Protocol Bindings and abort these steps.
+ If there is an [[\unobserveHandler]] of type {{Function}} defined
+ for |name| on |property|, invoke that with |options|, send back a
+ reply following the Protocol Bindings and abort these steps.
Let |sender| be the matching observer found in |property|'s
@@ -2349,7 +2550,7 @@ The PropertyWriteHandler callback
If invoking this method is not allowed for the current scripting context for security reasons, [= exception/throw =] a {{SecurityError}} and abort these steps.
- Let |interaction| be the value of ||td||'s |properties|'s
+ Let |interaction| be the value of [[\td]]'s |properties|'s
|name|.
@@ -2357,7 +2558,7 @@ The PropertyWriteHandler callback
[= exception/throw =] {{NotFoundError}} and abort these steps.
- Set the internal slot ||writeHandler|| on |interaction|
+ Set the internal slot [[\writeHandler]] on |interaction|
to |handler|.
@@ -2381,7 +2582,7 @@ The PropertyWriteHandler callback
according to the Protocol Bindings and abort these steps.
- Let |interaction| be the value of ||td||'s |properties|'s
+ Let |interaction| be the value of [[\td]]'s |properties|'s
|name|.
@@ -2391,7 +2592,7 @@ The PropertyWriteHandler callback
Let |handler:function| be `null`.
- If there is a user provided internal slot ||writeHandler||
+ If there is a user provided internal slot [[\writeHandler]]
on |interaction|, let |handler| be that.
@@ -2476,7 +2677,7 @@ The ActionHandler callback
If invoking this method is not allowed for the current scripting context for security reasons, [= exception/throw =] a {{SecurityError}} and abort these steps.
- Let |interaction| be the value of ||td||'s |actions|'s
+ Let |interaction| be the value of [[\td]]'s |actions|'s
|name|.
@@ -2484,7 +2685,7 @@ The ActionHandler callback
[= exception/throw =] a {{NotFoundError}} and abort these steps.
- Set the internal slot ||actionHandler|| on |interaction|
+ Set the internal slot [[\actionHandler]] on |interaction|
to |action|.
@@ -2505,7 +2706,7 @@ The ActionHandler callback
according to the Protocol Bindings and abort these steps.
- Let |interaction| be the value of ||td||'s |properties|'s
+ Let |interaction| be the value of [[\td]]'s |properties|'s
|name|.
@@ -2515,7 +2716,7 @@ The ActionHandler callback
Let |handler:function| be `null`.
- If there is a user provided internal slot ||actionHandler||
+ If there is a user provided internal slot [[\actionHandler]]
on |interaction|, let |handler| be its value.
@@ -2588,7 +2789,7 @@ The EventSubscriptionHandler callback
If invoking this method is not allowed for the current scripting context for security reasons, [= exception/throw =] a {{SecurityError}} and abort these steps.
- Let |interaction| be the value of ||td||'s |events|'s
+ Let |interaction| be the value of [[\td]]'s |events|'s
|name|.
@@ -2596,7 +2797,7 @@ The EventSubscriptionHandler callback
[= exception/throw =] a {{NotFoundError}} and abort these steps.
- Set the internal slot ||subscribeHandler|| on |interaction|
+ Set the internal slot [[\subscribeHandler]] on |interaction|
to |handler|.
@@ -2621,7 +2822,7 @@ The EventSubscriptionHandler callback
according to the Protocol Bindings and abort these steps.
- Let |interaction| be the value of ||td||'s |events|'s
+ Let |interaction| be the value of [[\td]]'s |events|'s
|name|.
@@ -2629,11 +2830,11 @@ The EventSubscriptionHandler callback
{{NotFoundError}} and abort these steps.
- If |name| has an associated ||subscribeHandler|| internal slot,
+ If |name| has an associated [[\subscribeHandler]] internal slot,
invoke it with |options| and abort these steps.
- Otherwise, if no ||subscribeHandler|| is defined, then implement the
+ Otherwise, if no [[\subscribeHandler]] is defined, then implement the
default subscriber mechanism:
-
@@ -2674,7 +2875,7 @@
The EventSubscriptionHandler callback
If invoking this method is not allowed for the current scripting context for security reasons, [= exception/throw =] a {{SecurityError}} and abort these steps.
-
- Let |interaction| be the value of ||td||'s |events|'s
+ Let |interaction| be the value of [[\td]]'s |events|'s
|name|.
-
@@ -2682,7 +2883,7 @@
The EventSubscriptionHandler callback
[= exception/throw =] a {{NotFoundError}} and abort these steps.
-
- Set the internal slot ||unsubscribeHandler|| on |interaction|
+ Set the internal slot [[\unsubscribeHandler]] on |interaction|
to |handler|.
-
@@ -2707,7 +2908,7 @@
The EventSubscriptionHandler callback
according to the Protocol Bindings and abort these steps.
-
- Let |interaction| be the value of ||td||'s |events|'s
+ Let |interaction| be the value of [[\td]]'s |events|'s
|name|.
-
@@ -2715,7 +2916,7 @@
The EventSubscriptionHandler callback
{{NotFoundError}} and abort these steps.
-
- If |name| has an associated ||unsubscribeHandler||
+ If |name| has an associated [[\unsubscribeHandler]]
internal slot that is a function,
invoke it with |options| and abort these steps.
@@ -2758,7 +2959,7 @@ The EventSubscriptionHandler callback
If invoking this method is not allowed for the current scripting context for security reasons, [= exception/throw =] a {{SecurityError}} and abort these steps.
- Let |interaction| be the value of ||td||'s |events|'s
+ Let |interaction| be the value of [[\td]]'s |events|'s
|name|.
@@ -2766,7 +2967,7 @@ The EventSubscriptionHandler callback
[= exception/throw =] a {{NotFoundError}} and abort these steps.
- Set the internal slot ||eventHandler|| of |interaction| to
+ Set the internal slot [[\eventHandler]] of |interaction| to
|eventHandler|.
@@ -2784,14 +2985,14 @@ The EventSubscriptionHandler callback
following steps:
-
- Let |interaction| be the value of ||td||'s |events|'s
+ Let |interaction| be the value of [[\td]]'s |events|'s
|name|.
-
If |data| is not defined or `null`,
-
- Let |eventHandler| be the value of the ||eventHandler||
+ Let |eventHandler| be the value of the [[\eventHandler]]
internal slot of |interaction|.
-
@@ -2832,7 +3033,7 @@
The EventSubscriptionHandler callback
If invoking this method is not allowed for the current scripting context for security reasons, [= exception/throw =] a {{SecurityError}} and abort these steps.
-
- Let |interaction| be the value of ||td||'s |events|'s |name|.
+ Let |interaction| be the value of [[\td]]'s |events|'s |name|.
-
If an Event with the name |name| is not found,
@@ -2861,25 +3062,25 @@
The EventSubscriptionHandler callback
If invoking this method is not allowed for the current scripting context for security reasons, reject |promise| with a {{SecurityError}} and abort these steps.
-
- Run the expand a TD steps on the internal slot ||td||.
+ Run the expand a TD steps on the internal slot [[\td]].
-
- Run the validate a TD on ||td||. If that fails,
+ Run the validate a TD on [[\td]]. If that fails,
reject |promise| with a {{TypeError}} and abort these steps.
-
- For each Property definition in ||td||'s |properties|,
+ For each Property definition in [[\td]]'s |properties|,
initialize an |internal observer list| internal slot
in order to store observe request data needed to notify the observers on value changes.
-
- For each Event definition is ||td||'s |events|,
+ For each Event definition is [[\td]]'s |events|,
initialize an |internal listener list| internal slot
in order to store subscription request data needed to notify the
Event listeners.
-
- Set up the WoT Interactions based on introspecting ||td||
+ Set up the WoT Interactions based on introspecting [[\td]]
as explained in [[!WOT-TD]] and [[!WOT-PROTOCOL-BINDINGS]].
Make a request to the underlying platform to initialize the
Protocol Bindings and then start serving external requests