-
Notifications
You must be signed in to change notification settings - Fork 1
/
web-nfc.d.ts
80 lines (72 loc) · 2.06 KB
/
web-nfc.d.ts
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
// Type definitions for Web NFC
// Project: https://github.com/w3c/web-nfc
// Definitions by: Takefumi Yoshii <https://github.com/takefumi-yoshii>
// TypeScript Version: 3.9
// This type definitions referenced to WebIDL.
// https://w3c.github.io/web-nfc/#actual-idl-index
interface Window {
NDEFMessage: NDEFMessage;
}
declare class NDEFMessage {
constructor(messageInit: NDEFMessageInit);
records: ReadonlyArray<NDEFRecord>;
}
declare interface NDEFMessageInit {
records: NDEFRecordInit[];
}
declare type NDEFRecordDataSource = string | BufferSource | NDEFMessageInit;
interface Window {
NDEFRecord: NDEFRecord;
}
declare class NDEFRecord {
constructor(recordInit: NDEFRecordInit);
readonly recordType: string;
readonly mediaType?: string;
readonly id?: string;
readonly data?: DataView;
readonly encoding?: string;
readonly lang?: string;
toRecords?: () => NDEFRecord[];
}
declare interface NDEFRecordInit {
recordType: string;
mediaType?: string;
id?: string;
encoding?: string;
lang?: string;
data?: NDEFRecordDataSource;
}
declare type NDEFMessageSource = string | BufferSource | NDEFMessageInit;
interface Window {
NDEFReader: NDEFReader;
}
declare class NDEFReader extends EventTarget {
constructor();
onreading: (this: this, event: NDEFReadingEvent) => any;
onreadingerror: (this: this, error: Event) => any;
scan: (options?: NDEFScanOptions) => Promise<void>;
write: (message: NDEFMessageSource, options?: NDEFWriteOptions) => Promise<void>;
makeReadOnly: (options?: NDEFMakeReadOnlyOptions) => Promise<void>;
}
interface Window {
NDEFReadingEvent: NDEFReadingEvent;
}
declare class NDEFReadingEvent extends Event {
constructor(type: string, readingEventInitDict: NDEFReadingEventInit);
serialNumber: string;
message: NDEFMessage;
}
interface NDEFReadingEventInit extends EventInit {
serialNumber?: string;
message: NDEFMessageInit;
}
interface NDEFWriteOptions {
overwrite?: boolean;
signal?: AbortSignal;
}
interface NDEFMakeReadOnlyOptions {
signal?: AbortSignal;
}
interface NDEFScanOptions {
signal: AbortSignal;
}