Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.

Commit 32a35db

Browse files
tweaks to make FPWD API usable
1 parent 4e8cf98 commit 32a35db

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

index.d.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ export declare enum DiscoveryMethod {
5959
/** The ThingInit dictionary contains properties to initialize a Thing */
6060
export interface ThingInit {
6161
/** The name attribute represents the user given name of the Thing */
62-
name: string; // DOMString
62+
name?: string; // DOMString
6363
/** The url attribute represents the address of the Thing */
64-
url: USVString;
64+
url?: USVString;
6565
/** The description attribute represents the Thing Description of the Thing */
66-
description: object; // Dictionary
66+
description?: object; // Dictionary
6767
}
6868

6969
/** The ConsumedThing interface is a client API for sending requests to servers in order to retrieve or update properties, invoke Actions, and observe properties, Actions and Events. */
@@ -225,15 +225,18 @@ export interface SemanticType {
225225
context: USVString;
226226
}
227227

228+
export declare type PropertyHandler = (newValue: any, oldValue: any) => void;
229+
228230
/** Represents the Thing Property description. */
229231
export interface ThingPropertyInit {
230232
name: string
231-
configurable: boolean; // = false;
232-
enumerable: boolean; // = true;
233-
writable: boolean; // = true;
233+
configurable?: boolean; // = false;
234+
enumerable?: boolean; // = true;
235+
writable?: boolean; // = true;
234236
// observable: boolean; // = false;
235-
semanticTypes: [SemanticType];
237+
semanticTypes?: [SemanticType];
236238
description: ThingDescription;
239+
onWrite?: PropertyHandler;
237240
value: any;
238241
}
239242

@@ -242,11 +245,11 @@ export interface ThingActionInit {
242245
/** The name attribute provides the Action name. */
243246
name: string;
244247
/** The inputDataDescription attribute provides the description of the input arguments. */
245-
inputDataDescription: ThingDescription;
248+
inputDataDescription?: ThingDescription;
246249
/** The outputDataDescription attribute provides the description of the returned data. */
247-
outputDataDescription: ThingDescription;
250+
outputDataDescription?: ThingDescription;
248251
/** The semanticTypes attribute provides a list of semantic type annotations (e.g. labels, classifications etc) relevant to the Action, represented as SemanticType dictionaries. */
249-
semanticTypes: [SemanticType];
252+
semanticTypes?: [SemanticType];
250253
/** The action attribute provides a function that defines the Action. */
251254
action: Function;
252255
}
@@ -255,9 +258,9 @@ export interface ThingEventInit {
255258
/** The name attribute represents the event name. */
256259
name: string;
257260
/** The semanticTypes attribute represent a list of semantic type annotations attached to the event. */
258-
semanticTypes: [SemanticType];
261+
semanticTypes?: [SemanticType];
259262
/** The dataDescription attribute represents the description of the data that is attached to the event. */
260-
dataDescription: ThingDescription;
263+
dataDescription?: ThingDescription;
261264
}
262265

263266
export interface ExposedThing extends ConsumedThing {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wot-typescript-definitions",
3-
"version": "0.3.0-SNAPSHOT.6",
3+
"version": "0.3.0-SNAPSHOT.7",
44
"description": "Typescript definitions for the WoT scripting API",
55
"main": "index.d.ts",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)