-
Notifications
You must be signed in to change notification settings - Fork 72
/
web-nfc.idl
101 lines (78 loc) · 2.26 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
// 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/)
[Exposed=Window]
interface NDEFMessage {
constructor(NDEFMessageInit messageInit);
readonly attribute FrozenArray<NDEFRecord> records;
};
dictionary NDEFMessageInit {
sequence<NDEFRecordInit> records;
};
[Exposed=Window]
interface NDEFRecord {
constructor(NDEFRecordInit recordInit);
readonly attribute NDEFRecordType recordType;
readonly attribute USVString mediaType;
readonly attribute USVString id;
USVString? toText();
[NewObject] ArrayBuffer? toArrayBuffer();
[NewObject] any toJSON();
sequence<NDEFRecord> toRecords();
};
dictionary NDEFRecordInit {
NDEFRecordType recordType;
USVString mediaType;
USVString id;
any data;
};
typedef DOMString NDEFRecordType;
typedef (DOMString or ArrayBuffer or NDEFMessageInit) NDEFMessageSource;
[SecureContext, Exposed=Window]
interface NFCWriter {
constructor();
Promise<void> push(NDEFMessageSource message, optional NFCPushOptions options={});
};
[SecureContext, Exposed=Window]
interface NFCReader : EventTarget {
constructor();
attribute EventHandler onreading;
attribute EventHandler onerror;
void scan(optional NFCScanOptions options={});
};
[SecureContext, Exposed=Window]
interface NFCReadingEvent : Event {
constructor(DOMString type, NFCReadingEventInit readingEventInitDict);
readonly attribute DOMString serialNumber;
[SameObject] readonly attribute NDEFMessage message;
};
dictionary NFCReadingEventInit : EventInit {
DOMString? serialNumber = "";
required NDEFMessageInit message;
};
[SecureContext, Exposed=Window]
interface NFCErrorEvent : Event {
constructor(DOMString type, NFCErrorEventInit errorEventInitDict);
readonly attribute DOMException error;
};
dictionary NFCErrorEventInit : EventInit {
required DOMException error;
};
dictionary NFCPushOptions {
NFCPushTarget target = "any";
unrestricted double timeout = Infinity;
boolean ignoreRead = true;
AbortSignal? signal;
};
enum NFCPushTarget {
"tag",
"peer",
"any"
};
dictionary NFCScanOptions {
USVString id = "";
NDEFRecordType recordType;
USVString mediaType = "";
AbortSignal? signal;
};