/
web-nfc.idl
103 lines (85 loc) · 2.51 KB
/
web-nfc.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into reffy-reports
// (https://github.com/tidoust/reffy-reports)
// Source: Web NFC API (https://w3c.github.io/web-nfc/)
[Constructor(NDEFMessageInit messageInit), Exposed=Window]
interface NDEFMessage {
readonly attribute USVString url;
readonly attribute FrozenArray<NDEFRecord> records;
};
dictionary NDEFMessageInit {
USVString url;
sequence<NDEFRecordInit> records;
};
typedef (DOMString or unrestricted double or ArrayBuffer or Dictionary) NDEFRecordData;
[Constructor(NDEFRecordInit recordInit), Exposed=Window]
interface NDEFRecord {
readonly attribute NDEFRecordType recordType;
readonly attribute USVString mediaType;
USVString toText();
[NewObject] ArrayBuffer toArrayBuffer();
[NewObject] object toJSON();
};
dictionary NDEFRecordInit {
NDEFRecordType recordType;
USVString mediaType;
NDEFRecordData data;
};
enum NDEFRecordType {
"empty",
"text",
"url",
"json",
"opaque"
};
typedef (DOMString or ArrayBuffer or NDEFMessageInit) NDEFMessageSource;
[Constructor(), SecureContext, Exposed=Window]
interface NFCWriter {
Promise<void> push(NDEFMessageSource message, optional NFCPushOptions options={});
};
[Constructor(optional NFCReaderOptions options={}), SecureContext, Exposed=Window]
interface NFCReader : EventTarget {
attribute EventHandler onreading;
attribute EventHandler onerror;
void start();
void stop();
};
[Constructor(DOMString type, NFCReadingEventInit readingEventInitDict), SecureContext, Exposed=Window]
interface NFCReadingEvent : Event {
readonly attribute DOMString serialNumber;
[SameObject] readonly attribute NDEFMessage message;
};
dictionary NFCReadingEventInit : EventInit {
DOMString? serialNumber = "";
required NDEFMessageInit message;
};
[Constructor(DOMString type, NFCErrorEventInit errorEventInitDict), SecureContext, Exposed=Window]
interface NFCErrorEvent : Event {
readonly attribute DOMException error;
};
dictionary NFCErrorEventInit : EventInit {
required DOMException error;
};
enum NDEFCompatibility {
"nfc-forum",
"vendor",
"any"
};
dictionary NFCPushOptions {
NFCPushTarget target = "any";
unrestricted double timeout = Infinity;
boolean ignoreRead = true;
AbortSignal? signal;
NDEFCompatibility compatibility = "nfc-forum";
};
enum NFCPushTarget {
"tag",
"peer",
"any"
};
dictionary NFCReaderOptions {
USVString url = "";
NDEFRecordType recordType;
USVString mediaType = "";
NDEFCompatibility compatibility = "nfc-forum";
};