Skip to content

Commit a193afa

Browse files
committed
Merge pull request #44 from zolkis/gh-pages
New version of the Web NFC specification and the Security and Privacy document.
2 parents 85ad597 + ced3e6b commit a193afa

File tree

4 files changed

+2096
-581
lines changed

4 files changed

+2096
-581
lines changed

idl/draft.idl

Lines changed: 0 additions & 56 deletions
This file was deleted.

idl/web-nfc.idl

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
partial interface Navigator {
23
readonly attribute NFC nfc;
34
};
@@ -6,30 +7,38 @@ interface NFC {
67
Promise<NFCAdapter> requestAdapter();
78
};
89

9-
interface NFCAdapter : EventTarget {
10-
attribute EventHandler onmessage;
11-
Promise<void> send (NFCMessage message, optional NFCSendOptions options);
12-
};
10+
interface NFCAdapter {
11+
Promise<void> pushMessage(NFCMessage message, optional NFCPushOptions options);
12+
void cancelPush();
1313

14-
interface NFCMessageEvent : Event {
15-
readonly attribute NFCMessage message;
14+
Promise<long> watch(NFCWatchOptions options, MessageCallback callback);
15+
Promise<void> unwatch(long id);
1616
};
1717

18-
[NoInterfaceObject]
19-
interface NFCMessage {
20-
readonly attribute USVString scope;
21-
readonly attribute sequence<any> data; // (DOMString or URL or Blob or JSON)
18+
dictionary NFCPushOptions {
19+
NFCDeviceType target;
20+
long timeout; // in ms, default (and max) is 10sec, UAs MAY shorten it
2221
};
2322

24-
typedef (DOMString or URL or Blob or JSON) NFCData;
23+
enum NFCPushTarget { "tag", "peer", "any" };
2524

26-
enum NFCTarget {
27-
"tag",
28-
"peer",
29-
"any"
30-
};
25+
dictionary NFCWatchOptions {
26+
USVString url; // domain/path or URL pattern
27+
USVString kind;
28+
USVString type;
29+
NFCWatchMode mode;
30+
}
3131

32-
dictionary NFCSendOptions {
33-
NFCTarget target;
32+
enum NFCWatchMode { "web-only", "all" };
33+
34+
callback MessageCallback = void (NFCMessage message, USVString url);
35+
36+
dictionary NFCRecord {
37+
NFCRecordType kind; // based on TNF + JSON
38+
USVString type; // IANA media type, with parameters
39+
any data; // null, string (text, url), Object (json), ArrayBuffer
3440
};
3541

42+
typedef sequence<NFCRecord> NFCMessage;
43+
44+
enum NFCRecordType { "empty", "text", "url", "json", "opaque" };

0 commit comments

Comments
 (0)