183570_dom_wpt_resync
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / interfaces / web-nfc.idl
1
2       dictionary NFCMessage {
3         sequence<NFCRecord> records;
4         USVString url;
5       };
6
7       typedef (DOMString or unrestricted double or ArrayBuffer or Dictionary) NFCRecordData;
8
9       dictionary NFCRecord {
10         NFCRecordType recordType;
11         USVString mediaType;
12         NFCRecordData data;
13       };
14
15         enum NFCRecordType {
16           "empty",
17           "text",
18           "url",
19           "json",
20           "opaque"
21         };
22
23     partial interface Navigator {
24       readonly attribute NFC nfc;
25     };
26
27     typedef (DOMString or ArrayBuffer or NFCMessage) NFCPushMessage;
28
29     interface NFC {
30       Promise<void> push(NFCPushMessage message, optional NFCPushOptions options);
31       Promise<void> cancelPush(optional NFCPushTarget target="any");
32       Promise<long> watch(MessageCallback callback, optional NFCWatchOptions options);
33       Promise<void> cancelWatch(optional long id);
34     };
35
36     callback MessageCallback = void (NFCMessage message);
37
38       dictionary NFCPushOptions {
39         NFCPushTarget target = "any";
40         unrestricted double timeout = Infinity;
41         boolean ignoreRead = true;
42       };
43
44       enum NFCPushTarget {
45         "tag",
46         "peer",
47         "any"
48       };
49
50         dictionary NFCWatchOptions {
51           USVString url = "";
52           NFCRecordType? recordType;
53           USVString mediaType = "";
54           NFCWatchMode mode = "web-nfc-only";
55         };
56
57       enum NFCWatchMode {
58         "web-nfc-only",
59         "any"
60       };