Revision 36c9fdd4ef36c289f416a16707074157d818ea7c authored by Philipp Hancke on 27 July 2018, 12:35:09 UTC, committed by Robert Ma on 27 July 2018, 14:22:07 UTC
BUG=836871

Change-Id: I278b34cb305a13a029e84eaaeec57144e2858678
Reviewed-on: https://chromium-review.googlesource.com/1149364
Reviewed-by: Henrik Boström <hbos@chromium.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/master@{#578611}
1 parent e79b848
Raw File
web-nfc.idl
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Web NFC API" spec.
// See: https://w3c.github.io/web-nfc/

dictionary NFCMessage {
  sequence<NFCRecord> records;
  USVString url;
};

typedef (DOMString or unrestricted double or ArrayBuffer or Dictionary) NFCRecordData;

dictionary NFCRecord {
  NFCRecordType recordType;
  USVString mediaType;
  NFCRecordData data;
};

enum NFCRecordType {
  "empty",
  "text",
  "url",
  "json",
  "opaque"
};

partial interface Navigator {
  [SecureContext, SameObject] readonly attribute NFC nfc;
};

typedef (DOMString or ArrayBuffer or NFCMessage) NFCPushMessage;

[SecureContext]
interface NFC {
  Promise<void> push(NFCPushMessage message, optional NFCPushOptions options);
  Promise<void> cancelPush(optional NFCPushTarget target = "any");
  Promise<long> watch(MessageCallback callback, optional NFCWatchOptions options);
  Promise<void> cancelWatch(optional long id);
};

callback MessageCallback = void (NFCMessage message);

dictionary NFCPushOptions {
  NFCPushTarget target = "any";
  unrestricted double timeout = Infinity;
  boolean ignoreRead = true;
};

enum NFCPushTarget {
  "tag",
  "peer",
  "any"
};

dictionary NFCWatchOptions {
  USVString url = "";
  NFCRecordType? recordType;
  USVString mediaType = "";
  NFCWatchMode mode = "web-nfc-only";
};

enum NFCWatchMode {
  "web-nfc-only",
  "any"
};
back to top