-
Notifications
You must be signed in to change notification settings - Fork 67
/
draft.idl
56 lines (44 loc) · 1.66 KB
/
draft.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
// This is the WebIDL for the next version under work
// based on discussions on issues #2, #3, #26, #40.
//
// Changes:
// - reintroduce watch (since addEventListener is not allowed to prompt, and
// events vs watches were tricky to implement: too many corner cases
// - reintroduce watch options, filtering on URL patterns, data type etc.
// - replace onmessage event with MessageCallback
// - change send() to pushMessage() - better aligned with semantics
// - add timeout to push options
// - NFCRecord data should be "any"
// - replace scope with URL
// - permission policies changed (in the spec)
partial interface Navigator {
readonly attribute NFC nfc;
};
interface NFC {
Promise<NFCAdapter> requestAdapter();
};
interface NFCAdapter {
Promise<void> pushMessage(NFCMessage message, optional NFCPushOptions options);
Promise<long> watch(NFCWatchOptions options, MessageCallback callback);
void unwatch(long id);
};
callback MessageCallback = void (NFCMessage message, USVString url);
dictionary NFCWatchOptions {
USVString url; // domain/path or URL pattern
USVString kind;
USVString type;
NFCWatchMode mode;
}
enum NFCWatchMode { "web-only", "all" };
dictionary NFCPushOptions {
NFCDeviceType target;
long timeout; // in ms, default (and max) is 10sec, UAs MAY shorten it
};
enum NFCPushTarget { "tag", "peer", "any" };
dictionary NFCRecord {
NFCRecordType kind; // based on TNF + JSON
USVString type; // IANA media type, with parameters
any data; // null, string (text, url), Object (json), ArrayBuffer
};
typedef sequence<NFCRecord> NFCMessage;
enum NFCRecordType { "empty", "text", "url", "json", "opaque" };